6. Miscellaneous

No matter how much you try, some advice doesn’t fit neatly into a category. Even so, this miscellaneous advice is important. It involves practices you’ll use every day, and following it will make your code easier to use, easier to understand, and easier to extend in the future.

Item 45: Minimize the Visibility of Nullable Values

Nullable types require more checks than non-nullable types. It makes more sense to use non-nullable structs whenever you can and to limit nullable types to those algorithms that require the nullable abstraction. Nullable types add a missing, or unavailable, value to a non-nullable struct. In many ways, this makes using nullable types similar to older designs that used a marker value for a missing value. ...

Get More Effective C#: 50 Specific Ways to Improve Your C# 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.