O'Reilly logo

More Effective C#: 50 Specific Ways to Improve Your C# by Bill Wagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 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.

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required