Tech Off Post

Single Post Permalink

View Thread: Why are string types immutable in C#?
  • User profile image
    littleguru

    I can only repeat what has been mentioned before: by hiding the new allocating of string objects the .NET runtime would have to create always new memory chunks where the strings are stored.


    It's how current systems are build. It's the best to give the user the choice when to create a new instance of a string... It's always the best not to take all the control away from the user.