Question 1:
For answer this please check below link.
Click here to see Answer
Question 2:
For answer this please check below link.
Click here to see Answer
Click here to see Answer
public class Person { public string Name { get; set; } } public class Program { private static void Main(string[] args) { var person1 = new Person { Name = "Test" }; Console.WriteLine(person1.Name);//Output:Test Person person2 = person1; person2.Name = "Shahrooz"; Console.WriteLine(person1.Name);//Output:Shahrooz person2 = null; Console.WriteLine(person1.Name);//Output:??? } }
Question 2:
public class MyClass { public void Func(Object a) { Console.WriteLine("Object"); } public void Func(String a) { Console.WriteLine("String"); } } public class Program { private static void Main(string[] args) { MyClass mc = new MyClass(); mc.Func(null); } }
Click here to see Answer
Click here to see Answer