String is a value types, this are implicitly derived from System. ValueType. This class actually overrides the implementation in System. Object, the base class for all objects which is a reference type itself.
Value types are stored in the Stack.
Rajkumar said:
(Dec 27, 2011)
No wrong string is reference type its value store in heap.
Yakesh said:
(Jul 17, 2012)
Ya rajkumar is right, string, object are reference types. All remaining built in data types are value types.
Sami said:
(Jan 4, 2014)
String and object are reference types. While int, float, bool and all other are value types. Value types are stored on stack as well as heap. But strings are always stored on heap.
String is always created in string buffer. So no stack, no heap is required for string. String is primitive because primitive data type which are understandable by respected language compiler and string is one of that data type.
Sudarshan said:
(Jul 4, 2015)
String is reference type.
String s; where s is heap. So string is created on the heap.
Narasimha said:
(Nov 4, 2015)
String is always reference type so it can stored in heap memory.
Post your comments here:
Name *:
Email : (optional)
» Your comments will be displayed only after manual approval.