Is string reference type / value type?
Answer Posted / mathew
I am confused,
Microsoft in one site says "String is a reference type".
Check the below website
http://msdn.microsoft.com/en-us/library/362314fe.aspx
It says
"Although string is a Reference type, the equality
operators (== and !=) are defined to compare the values of
string objects, not references. This makes testing for
string equality more intuitive".
while when checked the other website
http://msdn.microsoft.com/en-us/library/83fhsxwc.aspx
Which list's "Built-In Types Table (C# Reference)" which has
STRING in the list
C# Type .NET Framework Type
--------- ---------------------
bool System.Boolean
byte System.Byte
sbyte System.SByte
char System.Char
decimal System.Decimal
double System.Double
float System.Single
int System.Int32
uint System.UInt32
long System.Int64
ulong System.UInt64
object System.Object
short System.Int16
ushort System.UInt16
string System.String
And it is mentioned
"All of the types in the table, except OBJECT and STRING,
are referred to as simple types."
From all these I infer that "STRING is a reference type".
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is global namespace in c#?
Is lazy thread safe c#?
In how many ways you can overload a method?
How does dll hell solve in .net?
How jit (just in time) works?
What is better C# or VB.NET?
Can I call a virtual method from a constructor/destructor?
What is jagged array?
Explain the difference between a Private Assembly and a Shared Assembly
Can we make a Static Constructor Parameterized? Give Reason with your answer
What are primitive types in c#?
What are access modifiers in c#?
What is dictionary collection in c#?
What basic steps are needed to display a simple report in crystal?
What is a data set in c#?