23
Reply

Is 'string' a value type or Reference type?

Kasam Shaikh

Kasam Shaikh

8y
974
1
Reply

    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.

    String is ref type.

    string is reference type and default is sealed class.

    Testing is working

    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

    Reference type

    It is a ref type

    Reference type because its does not have default allocation size

    String is a reference type and behaves like value type.

    Is ‘string’ a value type or Reference type?

    NO is this Testing

    Reference type

    Reference type

    Reference type

    Reference type

    Reference type

    Reference type

    Reference type

    Reference

    Reference

    Reference

    Reference

    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.

    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.