Click here to Skip to main content
16,017,608 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I want to ask a question that string is which type of object that is reference or global object
Posted
Comments
Sandeep Mewara 22-Apr-11 2:09am    
What?

String is a Class. And in C#, Classes are reference types.

There is a comprehensive documentation for System.String Class on MSDN.

Just search Google for "string C#" or "string .net" or "System.String" and you will get millions of results. I am sure you will find MSDN links on the very first page. :thumbsup:
 
Share this answer
 
I think you meant reference or value type. It is not a complete reference type nor a complete value type for me. It is handled very differently as compared to other data types.

Strings are stored in heap and not in stack. This is due to memory constraints in stack. But just like int, a value type, strings too are immutable (methods like string.Replace show that).

Still, if we go by what MSDN says, it is reference type.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900