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 the difference between int.parse and int.tryparse methods?

564


What is array and its types in c#?

516


What is string concatenation?

471


What is a partial class. Give an example?

505


Can abstract class be sealed?

476






What is the difference between values and reference types?

519


What is mvc firstordefault?

478


What is the console on a mac?

468


what is an exception in .net?

507


What is super class in c#?

455


what is the difference between interface and multiple interface?

528


What are the concepts of dispose method?

483


How to achieve polymorphism in c#?

537


How do I open the console?

600


How do you achieve polymorphism in c#?

500