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 Garbage Collection in .Net?
Why delegates are type safe?
Define an escape sequence, name few strings in escape sequence?
Explain About multi level and multiple inheritance how to achieve in .net
code for arranging given number in possible permutation ways ex:123,321,312,132,231,213.
What is the delegates in c#?
Why do we need reflection in c#?
What are the extension methods in c#?
Is c# good for beginners?
Why hashtable is thread safe in c#?
Explain About .NET Remoting and types of remoting
Wht executescaler method is used?
Explain About Virtual functions and their use.
What is an array class?
What is public or shared assemblies ?