{
class clsA
{
private int _i;
public int I
{
set { _i = value; }
get { return _i; }
}
}
struct strctB
{
private int _i;
public int I
{
set { _i = value; }
get { return _i; }
}
}
class Program
{
static void Main1(string[] args)
{
clsA a1=new clsA();
a1.I=1;
clsA a2=a1;
a2.I=2;
Console.WriteLine("{0},{1}", a1.I, a2.I);//2,2
strctB b1=new strctB();
b1.I = 1;
strctB b2=b1;
b2.I = 2;
Console.WriteLine("{0},{1}", b1.I, b2.I);//1,2
}
static void Main(string[] args)
{
clsA a1 = new clsA();
a1.I = 1;
clsA a2 = new clsA();
a2.I = 1;
Console.WriteLine("{0}", a1.Equals(a2));//False
strctB b1 = new strctB();
b1.I = 1;
strctB b2 = new strctB();
b2.I = 1;
Console.WriteLine("{0}", b1.Equals(b2));//True
}
}
}