Some things I think everyone in .NET should know :)
Enjoy!
- Structs in .NET do not support Inheritance. Heres why: http://stackoverflow.com/questions/1222935/why-dont-structs-support-inheritance
- An anonymous type is a Reference Type. But the GetHashCode and Equals are written for you by the compiler! http://odetocode.com/blogs/scott/archive/2008/03/25/and-equality-for-all-anonymous-types.aspx
- For Value types (structs) Equals and GetHashCode are overridden in the runtime. http://www.codeproject.com/KB/dotnet/DotNetEquality.aspx However you are free to override this by explicitly defining an override function.
- LINQ to objects works with collections in memory. So be careful when using Min/Max/Average etc.
- Every wonder what was up with String.Empty. It is after all "". Turns out no reason really : http://stackoverflow.com/questions/263191/in-c-should-i-use-string-empty-or-string-empty-or
Enjoy!
No comments:
Post a Comment