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();
}
}
}
相关文章
- 07-11[Go] GO中的字符串底层数据结构
- 07-1103 python中的if分支结构
- 07-11Leetcode练习(Python):数组类:第57题:给出一个无重叠的 ,按照区间起始端点排序的区间列表。 在列表中插入一个新的区间,你需要确保列表中的区间仍然有序且不重叠(如果有必要的话,可以合
- 07-11根据id获取该id在树形结构数据中的完整路径
- 07-11无法绑定到属于C#/ XAML应用程序中的WindowsFormsHost子对象的属性的解决方法?
- 07-11C#中关于内存的存放。
- 07-11Python中的三种数据结构
- 07-11c#中多个屏幕上的重复Windows窗体
- 07-11c# – 无法在鼠标事件处理程序中读取WPF中保持的键状态 – VMWare Fusion for Mac中Windows guest虚拟机中的行为不一致
- 07-11GO-结构体(类似python中的类)