Question:

What is Reference Type in C# ?

Answer:

Let us explain this with the help of an example. In the code given below,

Employee emp1;
Employee emp2 = new Employee();
emp1 = emp2;

Here emp2 has an object instance of Employee Class. But emp1 object is set as emp2. What this means is that the object emp2 is referred in emp1, rather than copying emp2 instance into emp1. When a change is made in emp2 object, corresponding changes can be seen in emp1 object. 


Keywords:

© 2017 QuizBucket.org