C# Corner
Tech
News
Videos
Forums
Trainings
Books
Live
More
Interviews
Events
Jobs
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
12
Reply
Is 'string' a value type or Reference type?
Kasam Shaikh
9y
3.4k
1
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
It is a reference type and more......explanation ........... .NET provides String Intern Pool to help in optimizing the usage of strings. String Intern Pool is a special table allocated on Large Object Heap which maintains references of all strings that are created on a program. CLR keeps track of those strings that are created in memory and uses it when it needs to create the same string again. This ensures that new memory is not used whenever the content of the string is not different.
Sujeet Singh
8y
2
String is ref type.
Sridhar Sharma
9y
1
string is reference type and default is sealed class.
Naveen Bisht
9y
1
Reference type because its does not have default allocation size
Ayappan Alagesan
9y
1
String is a reference type and behaves like value type.
Kasam Shaikh
9y
1
string is reference type
Satish Sanaboyina
8y
0
string is reference type.
Satish Sanaboyina
8y
0
string is reference type,all primitive data types except general data type(string &object ) are value types.class, interface and delegates are reference type,in which the memory will store in heap memory.structures and enums are value type in which memory will store in stack memory
Kiran Kumar
8y
0
Reference
Mukesh Kumar
8y
0
string is reference type and it value stored on heap. String is a reference type instead of a value type because it was of crucial importance for Microsoft to ensure that strings could be stored in the most efficient way in non-generic collections, such as System.Collection.ArrayList.
sushil kumar
8y
0
It is a ref type
Sripathi Rao
8y
0
string is a reference type. In the following code: string message = "Hello"; The actual content "Hello" is stored on the heap while the message variable is stored on the stack. Message contains a reference to that text.
Kyle Cheung
9y
0
Message