Fun with SkipLocalsInit

The next version of C# might support the SkipLocalsInit attribute. This attribute is an indicator to Roslyn (the C# compiler) to avoid emitting the localsinit flags for the annotated methods.

This new feature can only be used with the /unsafe compiler switch - and as we shall see, with good reason.

Read more

Bonus of the Null-Propagation Operator

The Null Propagation Operator ?. has been a part of C# for almost 5 years. The feature was well-thought out and well received, and has become so prevalent in every code-base out there that I can't remember life before it.

So it was quite jarring to realise that I forgot how it works...

Read more

Building Builders

The Builder Pattern is a software design pattern where the logic to set up an object is separated from the actual object. As discussed last time, this patterns is particularly useful when dealing with immutable types where all the information about the object is often required at the time of construction. The builder pattern allows the information required to construct the object to be collected separately by code with different concerns, until the point Build is called to actually construct the object.

With code generation baked into roslyn, patterns such as the Builder Pattern which often require a lot of boilerplate code will be extremely simple to automate. In this post we will investigate how easy this really is.

Read more
Page 1 of 3
Next Page »