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
Explain the difference between pass by value and pass by reference.
What are functions c#?
What is class and object c#?
What is the difference between == and object.equals?
Is c# an array?
Why is ienumerable used?
Can an exception be thrown from a catch block?
Name any three ways to pass parameters to a method in c#?
Can dictionary have duplicate keys c#?
What do you mean by thread safe in c#?
What is gac? How to put assembly in gac?
What are PE(Portable Executable)?
What language is arduino?
Is Facebook a desktop application?
What is asp net c#?