首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么定义常量数组

2012-01-08 
如何定义常量数组?比如以下C++的代码如何转化成C#能识别的代码?structAAAA{intiintjintk}conststaticA

如何定义常量数组?
比如以下C++的代码如何转化成C#能识别的代码?
  struct   AAAA{
int   i;
int   j;
int   k;
};
  const   static   AAAA   s[]={
  {1,2,3},
  {1,2,3},
  {1,2,3},
  {1,2,3},
  };

[解决办法]
static readonly AAAA[] s={new AAAA(1,2,3),new AAAA(1,2,3)};
public struct AAAA
{
public AAAA(int i, int j,int k)
{
this.i = i;
this.j = j;
this.k=k;
}
public int i;
public int j;
public int k;
}

看看这样能不能满足

热点排行