Is string reference type / value type?
Answer Posted / djfox7200x
Strings are immutable.Hence they behave like a value type
when they are actually reference type;
eg. string objA="cat";
//cat is an immutable string in memory and objA points to
it.
string b=a; //reference is copied to b;
a="dog"; new immutable object created and a points to it;
//b is still cat since its refernce has not changed
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is dto c#?
if we are updating a database using thread, and mean while application crashes or thread being aborted then what will happen in Database? Rollback or Database will be updated? Please explain with different scenario.
Does c# replace c++?
What is the difference between xml documentation tag?
4. Describe the process when we send a request URL? And who is responsible for that?
How many types of constructors are available in c#?
How jit (just in time) works?
What is difference between ilist and list?
What is the main purpose of xml?
Does c# support #define for defining global constants?
What is the use of xmlserializer?
What is multidimensional array in c#?
How does dependency injection work c#?
Why do we use overloading in c#?
What is the difference between a field and a property in c#?