日期:2014-05-19  浏览次数:20876 次

如何定义常量数组?
比如以下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;
}

看看这样能不能满足