We know the concept of immutability but need to know few immutable types other than
Are there more?
A list of immutable types in the framework class library follows below. (Feel free to expand it!)
System.…
Byte
and SByte
Int16
and UInt16
Int32
and UInt32
Int64
and UInt64
IntPtr
Single
Double
Decimal
new { ... }
in C#, New With { ... }
in VB.NET)enum
, Enum
)obj.PropertyChanged += callback
, it's actually the obj.PropertyChanged
reference that is mutated to point to a newly constructed delegate instance; the original delegate instance stays unchanged.)DateTime
, TimeSpan
(mentioned in this answer) and DateTimeOffset
DBNull
Guid
Nullable
String
Tuple<…>
types introduced with .NET 4 (mentioned in this answer)Uri
Version
Void
System.Linq.…
Lookup