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


Please Help Members By Posting Answers For Below Questions

What is lazy t?

686


What is action in c# 3.5?

736


How do you sort an array in c#?

671


What is code verification?

703


What is the .net datatype that allows the retrieval of data by a unique key?

656


List the fundamental oop concepts?

677


Is c# still popular?

642


Explain about finalize method?

719


Is equal in c#?

667


What is difference between ienumerable and list in c#?

630


Is java better than c#?

676


Are there functions in c#?

696


Which is better interface or abstract class in c#?

587


What method is used to sort the elements of the array in descending order?

728


What are class fields?

682