none
String vs string RRS feed

  • Question

  • String  is a class and it is  reference type and  it holds heap region in memory 

    string is  struct . It is   value type and it holds  stack region in memory.

    is that true  ?


    Thursday, November 28, 2019 8:25 AM

All replies

  • Hi friend,

    Welcome to MSDN forum.

    No.

    >> string is  struct . It is   value type and it holds  stack region in memory.

    ## In C#, string is an alias for the String class in .NET Framework.  You could refer to the link.

    So, technically there is no difference between string and String. They belong to reference type which is allocated on the heap.

    In addition, I suppose the similar issue could help you.

    Hope all above will help you.

    Best Regards,

    Anna


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Proposed as answer by EckiS Thursday, November 28, 2019 8:39 PM
    Thursday, November 28, 2019 11:26 AM
  • Hi friend.

    Welcome to MSDN forum.

    As Anna said above, there is no differences between “String” and “string”. However, “string” has some characteristics of value type which is by designed and for convenience.

    Hope this could help you.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 29, 2019 6:32 AM
  • Hi friend

     

    Sorry to disturb you.

    Did you have any update? 

    If the issue solved, please mark the replies as answer and that will help other community members to easier search this helpful information.

    Thanks for your understanding.

     

    Best Regards,

    Anna


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, November 29, 2019 7:54 AM