Archiv der Kategorie: C#

Within this article I want to give a short overview over the new Tuple features in C# 7. So far, we already had a Tuple class in C#. But with the new one some technical details have changed and some … Weiterlesen →

C# 7 introduces a nice syntax to deconstruct a class and access all members. If you want to support deconstruction for an object you just must write a “Deconstruct” method which contains one or more out parameter which are used … Weiterlesen →

With C# 7.0 it is possible to create functions nested within other functions. This feature is called “local functions”. The following source code shows an according example. The function “Calc” is nested within the function “DoSomething”. As a result, … Weiterlesen →

Within this article I want to introduce some of the minor but helpful new features. These are binary literals, digit separators and out variables. Binary Literal So far, we could use decimal and hexadecimal literals in C#. With C# 7.0 … Weiterlesen →

The Command design pattern encapsulates a request as an object. This will allow adding additional functionality to the request. A typical example is the undo/redo functionality. The command object will be used as mediator between the client and the receiver … Weiterlesen →

According to the Single Responsibility Principle a class should have one, and only one, reason to change. To same statement is valid for methods. A method should do one thing only and therefore have only one reason to change. Unfortunately … Weiterlesen →

One of the five SOLID principles is Dependency Inversion. To implement according to this principle you can use interfaces and dependency injection. As a software application normally consists of hundreds or thousands of objects you will have to set up … Weiterlesen →