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


Please Help Members By Posting Answers For Below Questions

What is the use of console readline () in c#?

483


What is delimiter in c#?

499


What is the difference between dictionary and hashtable in c#?

486


Distinguish between a class and struct?

521


What does console readline do in c#?

495






How does c# achieve polymorphism?

482


Do while loops yes or no c#?

532


Explain the OOPS concept in C#?

591


Can I get the name of a type at runtime?

546


What language do desktop applications use?

486


What is the use of convert toint32 in c#?

540


What is jit? What are the different types of jit?

584


What is regex replace in c#?

525


Explain the process of inheriting a class into another class?

501


What is difference between ienumerable and enumerable in c#?

489