what is the difference between passing a value object by
reference and a reference object by value?
Answer Posted / ashish diwakar
Value Objects are the objects that contain the data as
objects such int, string, etc...
Reference Objects are the objects that contain the data as
reference such as StringBuilder,etc...
When a Value object is passed as reference the reference of
the object is passed to the method (which means that any
change made to variable will be reflected on the original
variable).
But when a Reference Object is passed by value Like :
StringBuilder sb =new StringBuilder();
sb.Append("hello");
Display(sb);
any change made on sb inside Display function will not
change value of sb.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is strong data type in c#?
Can enum have methods c#?
What is the difference between new and override in c#?
What can be done with c#?
What are extender provider components?
What is the difference between static and private constructor?
Describe two uses of the “using” statement during the operation of c#?
what is a static constructor?
How do you read an Excel sheet in C#?
Can fields inside a class be virtual?
What is hashset c#?
What are generic types?
What are virtual classes in c#?
How to get the sum of last 3 items in a list using lambda expressions?
What is desktop GUI application?