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
How long does it take to get a loop recorder put in?
What are the fundamental principles of oo programming?
What are the types of inheritance in c#?
How are Windows programs different from normal C-programs?
What is the max value of int32 in c#?
Differentiate between dataset and datareader?
What is exe in c#?
Define Abstract Class in C#
Can we declare private class in c#?
Does c# support templates?
How do I count the length of a string in c#?
What is the difference between Static, Const and read only?
Can we set image Source dynamically using C# in WPF application?
Why are strings immutable c#?
What is thread in c#?