6. Miscellaneous

Some items don’t fit convenient categories. But that does not limit their importance. Understanding exception-handling strategies is important for everyone. Other recommendations are constantly changing because C# is a living language, with an active community and an evolving standard. Still others may feel outdated, and yet still resonate today. This chapter contains those items that just don’t fit easy categories.

Item 45: Minimize Boxing and Unboxing

Value types are containers for data. They are not polymorphic types. On the other hand, the .NET Framework was designed with a single reference type, System.Object, at the root of the entire object hierarchy. These two goals are at odds. The .NET Framework uses boxing and unboxing ...

Get Effective C# (Covers C# 4.0): 50 Specific Ways to Improve Your C#, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.