Referring to the example below, what is going on when the new logger is created? Several lines start with a ".". I'm guessing this is object initialization, but it doesn't seem like normal constructor arguments.
What is this syntax doing?
Referring to the example below, what is going on when the new logger is created? Several lines start with a ".". I'm guessing this is object initialization, but it doesn't seem like normal constructor arguments.
What is this syntax doing?
This is just a chain of methods and properties. You can take:
something.A.B().C.D().E.F();
And add newlines to write it as:
something
.A.B()
.C.D()
.E.F();
More generally, this style of method chaining to configure an object is called a Fluent Interface.
The object is created here:
new LoggerConfiguration()
The next part is accessing a property on the new object:
.MinimumLevel
Followed by a method call on the object referenced by that property:
.Verbose()
And so on.
The entire statement represents a single expression, the result of which is assigned to the variable logger
.