Ilogger Articles

Articles related to Ilogger

ILogger and Null Object Pattern

ILogger and Null Object Pattern

The Null Object Pattern is a pattern that uses objects with null behavior instead of performing null checks throughout the codebase. ILogger and ILoggerFactory are dependencies that often require a lot of null checking, so they are perfect candidates for the null object pattern. Suppose your classes take ILogger or ILoggerFactory as a dependency, and you are not using the null object pattern. In that case, you will probably find that your code is either subject to NullReferenceExceptions, or forcing implementors to supply loggers as arguments. Use the null object pattern to avoid both these problems. This article teaches you how in C#. Support this blog by signing up for my course Introduction to Uno Platform “Null object” might be confusing for some people because it seems to imply that the object reference might be null. However, the opposite is...
Christian Findlay Christian Findlay Sep 30, 2020