As follows:
using System;namespace ConsoleDemo
{
struct point
{
public int x;
public int y;
} unsafe class textapp
{
static public void Main()
{
Console.WriteLine("Size of point is :{0}",sizeof(point));
}
}
}
using System;namespace ConsoleDemo
{
struct point
{
public int x;
public int y;
} unsafe class textapp
{
static public void Main()
{
Console.WriteLine("Size of point is :{0}",sizeof(point));
}
}
}
这类语句必须包含在unsafe块中
{
public int a;
public int b;
}
这样就可以但是
struct SizeClass
{
public int a;
public int b;
public char[] c;
}
这样就出错,我知道C有128个字符,该怎么声明?
{
public int a;
public int b;
public char[] c = new char[128];
}
J:\cSharp\WinClassSize\Form1.cs(18): “WinClassSize.SizeClass.c” : 结构中不能有实例字段初始值设定项
楼上的,不行的说!:(