I have the following sample.
namespace sample
{
public class Customer
{
public int ID { get; set; }
public string Name { get; set; }
}
class Program
{
static void Main(string[] args)
{
Customer C1 = new Customer();
C1.ID = 100;
C1.Name = "Mary";
Customer C2 = C1;
C2.Name = "Sandra";
Console.WriteLine("C1.Name ={0} && C2.Name = {1}", C1.Name, C2.Name);
}
}
}
Why does the value of C1 changes when I assign a new value to C2. So in the end I get the following result: C1.Name =Sandra && C2.Name = Sandra