public void PrintValue(DogClass dg1) { Console.WriteLine("Inside the Method Print value- Class"); dg1.Color = "RedModified"; dg1.Name = "Dog1Modified"; Console.WriteLine("Color" + dg1.Color + " ; Name: " + dg1.Name); }
static void Main(string[] args) { DogClass d1 = new DogClass(); DogStruct d2 = new DogStruct(); ClassSample c = new ClassSample(); d1.Color = "Red"; d1.Name = "Dog1"; //d2.Color = "Red"; //d2.Name = "Dog2"; Console.WriteLine("***************Dog 1**********************"); Console.WriteLine("Color" + d1.Color + " ; Name: " + d1.Name); Console.WriteLine("***************Dog 2**********************"); Console.WriteLine("Color" + d2.Color + " ; Name: " + d2.Name); c.PrintValue(d1); c.PrintValue(d2); Console.WriteLine("***************After Print value**********************"); Console.WriteLine("***************Dog 1**********************"); Console.WriteLine("Color" + d1.Color + " ; Name: " + d1.Name); Console.WriteLine("***************Dog 2**********************"); Console.WriteLine("Color" + d2.Color + " ; Name: " + d2.Name); }