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
Is int reference type c#?
What is c sharp used for?
What is an expression in c#?
What is double c#?
What is decimal in c#?
What is the difference between decimal and integer?
What is Assembly. and Describe type of assembly. why most developer happy with private assembly.
How do you comment in c#?
Is string a data type in c#?
What is a generic in c#?
Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
Why do we need serialization?
Explain what a diffgram, and a good use for one Define diffgram? How it be used?
What is the difference between ienumerable and iqueryable?
What is the property of a class in c#?