Is string a value type or a reference type?
Is string a value type or a reference type?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Priya LingePosted Dec 5, 2011, 12:00 AM
1.String is a refrence type.
2. Its not value type as value-types need a known size for the stack etc. As a reference-type, the size of the reference is known in advance,
even if the size of the string isn't.
Hope this will help you.
Thanks.
Satyapriya NayakPosted Dec 5, 2011, 1:02 AM
String is a reference type
Refer
http://www.yoda.arachsys.com/csharp/strings.html
Thanks
Pravin MorePosted Dec 4, 2011, 11:54 PM
A String is a reference type even though it has most of the characteristics of a value type .Strings a can be huge, and need to be stored on the heap. Value types are stored on the stack.
Thanks,
Pravin.