/* * The default implementation of .ToString() method provided by System.Object class * will give you the complete name of the type including the namespace. */ static void Main(string[] args) { Customer c1 = new Customer(); c1.FirstName = "Anand Dev"; c1.LastName = "Singh"; Console.WriteLine("Without override .ToString() method -> {0}",c1.ToString()); // It will print complete name of the type including the namespace. CustomerWithOverriddenToString c2 = new CustomerWithOverriddenToString(); c2.FirstName = "Anand Dev"; c2.LastName = "Singh"; Console.WriteLine("\nAfter override .ToString() method -> {0}",c2.ToString()); Console.ReadKey(); }
/* * The default implementation of .ToString() method provided by System.Object class * will give you the complete name of the type including the namespace. */ static void Main(string[] args) { Customer c1 = new Customer(); c1.FirstName = "Anand Dev"; c1.LastName = "Singh"; Console.WriteLine("Without override .ToString() method -> {0}", c1.ToString()); // It will print complete name of the type including the namespace. CustomerWithOverriddenToString c2 = new CustomerWithOverriddenToString(); c2.FirstName = "Anand Dev"; c2.LastName = "Singh"; Console.WriteLine("\nAfter override .ToString() method -> {0}", c2.ToString()); Console.ReadKey(); }