namespace STRUCT_TEST
{
class Program
{
struct A
{
public int X;//不能直接對其進行賦值
public int Y;
public static string str = null;//靜態變量可以初始化
public A(int X, int Y)//帶參數的構造函數
{
this.X = X;
this.Y = Y;
Console.WriteLine("X={0},Y={1},str={2}",X ,Y ,str );
}
}
static void Main(string[] args)
{
A a = new A(1, 2);
A a1 = a;
a.X = 10;
Console.WriteLine("a1.X={0}",a1 .X );
Console.Read();
}
}
}