Using Tuples in C# to Initialize Properties in the Constructor and to Deconstruct Your Object

Recently I was asked by a developer what this code block here actually is:

public Friend(string firstName, string middleName, string lastName)
  => (FirstName, MiddleName, LastName) = (firstName, middleName, lastName);

This is actually a constructor that uses an expression body and tuples.

(more…)
Read more...

C# 9.0: Covariant Return Types – Specify More Specific Return Types in Overridden Methods and Properties

In the previous blog posts you learned about different C# 9.0 features:

In this blog post, let's look at another very interesting feature of C# 9.0, the covariant return types.

(more…)
Read more...