运行时错误,不知道怎么解决~~~~~下面是我的程序:using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices;namespace Test { class A { private int a; private double b; } class Program { static void Main(string[] args) { Console.WriteLine(Marshal.SizeOf(typeof(A)));
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;namespace Test
{ class A
{
private int a;
private double b;
} class Program
{
static void Main(string[] args)
{
Console.WriteLine(Marshal.SizeOf(typeof(A)));
}
}
}未处理的异常: System.ArgumentException: 类型“类类型.A”不能作为非托管结构进行封送处理;无法计算有意义的大小或偏移量。
在 System.Runtime.InteropServices.Marshal.SizeOf(Type t)
{
private int a;
private double b;
}