Avoid Returning Null From Methods – There Is a Better Way To Write Them!
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
Nullable reference types have improved C# by reducing NullReferenceExceptions, yet returning null from methods can make domain models less expressive. Instead, always return a proper object. By introducing types with valid defaults, avoid the need to handle nulls, simplifying both producers and consumers of objects. This follows the Null Object pattern, promoting more robust and maintainable code.
•9m watch time
2 Comments
Sort: