c# Programming Glossary: mutable
Why .NET String is immutable? [duplicate] http://stackoverflow.com/questions/2365272/why-net-string-is-immutable .NET String is immutable duplicate This question already has an answer here Why can't.. question already has an answer here Why can't strings be mutable in Java and .NET 16 answers As we all know String is.. and .NET 16 answers As we all know String is immutable. What are the reasons for String being immutable and the introduction..
Why isn't there generic variance for classes in C# 4.0? http://stackoverflow.com/questions/2733346/why-isnt-there-generic-variance-for-classes-in-c-sharp-4-0 you could build with a covariant class is something immutable as far as T is concerned. Now I think it would be awesome to.. Now I think it would be awesome to have covariant immutable lists and stacks and whatnot that were class types. But that.. in making the type system natively support covariant immutable class types. A comment above asked for an example of where this..
How do I assign by “reference” to a class field in c#? http://stackoverflow.com/questions/2980463/how-do-i-assign-by-reference-to-a-class-field-in-c The only work around for what you want is to have a shared mutable wrapper object an array or a hypothetical StringWrapper that.. here . Generally if you need this you can find a larger mutable object for the classes to share. public class StringWrapper..
Why are mutable structs evil? http://stackoverflow.com/questions/441309/why-are-mutable-structs-evil are mutable structs evil Following the discussions here on SO I already.. here on SO I already read several times the remark that mutable structs are evil like in the answer to this question . What's.. with mutability and structs c# struct immutability mutable share improve this question Structs are value types which..
GetHashCode Guidelines in C# http://stackoverflow.com/questions/462451/gethashcode-guidelines-in-c-sharp tell the whole story. The point being made is that for mutable types you cannot base the hash code on the mutable data because.. for mutable types you cannot base the hash code on the mutable data because two equal objects must return the same hash code..
How to call code behind server method from a client side javascript function? http://stackoverflow.com/questions/5828803/how-to-call-code-behind-server-method-from-a-client-side-javascript-function
Immutability of structs [duplicate] http://stackoverflow.com/questions/608542/immutability-of-structs of structs duplicate Possible Duplicate Why are mutable structs evil I read it in lots of places including here that.. including here that it's better to make structs as immutable. What's the reason behind this I see lots of Microsoft created.. this I see lots of Microsoft created structs that are mutable like the ones in xna. Probably there are many more in the BCL...
String vs. StringBuilder http://stackoverflow.com/questions/73883/string-vs-stringbuilder between String and StringBuilder StringBuilder being mutable but is there a large performance difference between the two..
Best algorithm for synchronizing two IList in C# 2.0 http://stackoverflow.com/questions/161432/best-algorithm-for-synchronizing-two-ilist-in-c-sharp-2-0 question For a start I'd get rid of the mutable struct. Mutable value types are a fundamentally bad thing. As are public fields..
Is there a workaround for overloading the assignment operator in C#? http://stackoverflow.com/questions/292676/is-there-a-workaround-for-overloading-the-assignment-operator-in-c type should be immutable whether or not it's a struct. Mutable structs are evil and a number certainly shouldn't be a mutable..
Why are C# number types immutable? http://stackoverflow.com/questions/3981827/why-are-c-sharp-number-types-immutable example. So let's consider a couple more involved ideas. Mutable reference type First there's this one what if Integer were a.. that t2.Integer would remain independent of t1.Integer . Mutable value type This could be approached another way of course keeping..
Why can iterators in structs modify this? http://stackoverflow.com/questions/4514538/why-can-iterators-in-structs-modify-this a non iterator produce different results static void Main Mutable m1 new Mutable m1.MutateWrong .ToArray Force the iterator to.. produce different results static void Main Mutable m1 new Mutable m1.MutateWrong .ToArray Force the iterator to execute Console.WriteLine.. After MutateWrong m1.Value Console.WriteLine Mutable m2 new Mutable m2.MutateRight Console.WriteLine After MutateRight..
Can structs contain references to reference types in C# http://stackoverflow.com/questions/945664/can-structs-contain-references-to-reference-types-in-c-sharp copy... foo.List.Add x Eek bar's list has now changed too Mutable structs are evil. Immutable structs with references to mutable..
|