What does the term immutable mean?

 Posted by Chikul on 12/21/2009 | Category: .NET Framework Interview questions | Views: 3491

In object-oriented and functional programming, an immutable object is an object whose state cannot be modified after it is created.
The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory. Ex: String.
Making an object immutable is usually inappropriate if the object contains a large amount of changeable data.
So, For this reason .NET has the System.Text.StringBuilder class which is Mutable and appropriate for large amount of changeable data.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response