> > Are delegates value types or reference types? I was just pondering the fact
> > that delegates are immutable... Does this mean that they are value types and
[quoted text clipped - 7 lines]
> fact counter-examples of each in the .NET Framework (the String class,
> for example).
The difference being that while immutable reference types are
reasonably common and perfectly reasonable, making value types mutable
is almost *always* a bad idea, and can result in some very confusing
behaviour!

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Michael Starberg - 26 Sep 2007 20:57 GMT
>> > Are delegates value types or reference types? I was just pondering the
>> > fact
[quoted text clipped - 9 lines]
>> fact counter-examples of each in the .NET Framework (the String class,
>> for example).
Peter:
I still miss the copy-on-write semantics for strings I loved in Delphi.
While I know C# and even .NET says strings are immutable,
Do you know if the CLR treats strings as smart?
I hope Nicholas Paldino reads this, as he'd be sure to know. =)
> The difference being that while immutable reference types are
> reasonably common and perfectly reasonable, making value types mutable
> is almost *always* a bad idea, and can result in some very confusing
> behaviour!
Hmm. Give me an example of when it would be almost a good idea. =)
- Michael Starberg