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 the difference between finally and finalize block?
What is the difference between values and reference types?
Why can’t struct be used instead of class for storing entity?
Explain the access modifiers in c#?
What is AutoMapper in C#?
What is type keyword in c#?
What is platform independence"?
What is the use of functional interface?
What language is c# similar to?
Is for loop faster than foreach?
What is the difference between list and arraylist in c#?
What is option parameter in C#?
What is the extension of c# file?
What is ildasm.exe used for?
What is the difference between convert and parse in c#?