Interviews - C# Corner

Kasam Shaikh
Is 'string' a value type or Reference type?
By Kasam Shaikh in C# onSep 20 2016
  • Sujeet Singh
    May, 2017 29

    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.

    • 2
  • Sridhar Sharma
    Mar, 2017 2

    String is ref type.

    • 1
  • Naveen Bisht
    Feb, 2017 16

    string is reference type and default is sealed class.

    • 1
  • Ayappan Alagesan
    Feb, 2017 10

    Reference type because its does not have default allocation size

    • 1
  • Kasam Shaikh
    Sep, 2016 20

    String is a reference type and behaves like value type.

    • 1
  • Satish Sanaboyina
    Mar, 2018 27

    string is reference type

    • 0
  • Satish Sanaboyina
    Mar, 2018 15

    string is reference type.

    • 0
  • Kiran Kumar
    Oct, 2017 24

    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

    • 0
  • Mukesh Kumar
    Aug, 2017 29

    Reference

    • 0
  • sushil kumar
    Jul, 2017 20

    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.

    • 0
  • Sripathi Rao
    Jul, 2017 7

    It is a ref type

    • 0
  • Kyle Cheung
    Mar, 2017 14

    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.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS