Asynchronous Code – Behind the Scenes – 001

If you were to ask me what was the biggest milestone in .Net development, then my choice would definetly be .Net 5.0 - especially the introduction of the async/await. The more you learn about the underlying working, you cannot but stop and admire the efforts done by the lang uage developers to make our life easier. … Continue reading Asynchronous Code – Behind the Scenes – 001

Revisiting Exception Handling in async methods

It is interesting to observe how the Exceptions behave in async code. While the .Net framework attempts to ensure the exprerience of handling failures in async methods are as similar to the synchronous methods, there are subtle differences which is worth understanding. Let us examine the following code. async Task<string> Foo() { var client = … Continue reading Revisiting Exception Handling in async methods

C# 8 : Using Declaration

The next feature we would explore in C# 8 is more off a syntatic sugar, but neverthless it is important to understand the difference between the new syntax and the original feature it is covering up. We are all aware of the Using statements, which allows correct usage of the IDisposible objects. Using Statement Let … Continue reading C# 8 : Using Declaration

C# 8 : Index and Range

While C# as a language has grown leaps and bounds, one are that was least addressed was manipulation of collections (arrays in particular). C# 8 looks to change exactly that by introducing two new Types. System.Index System.Index is a structure that can be used to Index a collection either from the start or the end. … Continue reading C# 8 : Index and Range

Automapper – Use IoC for creating Destinations

Automapper by default creates new instances of destination using the default contructor. If you need to ask the IoC to create the new instance, it actually turns out to be pretty simple. We will begin by setting up our Unity Container to register the IMapper. As you can see, you are also initializing the Automapper … Continue reading Automapper – Use IoC for creating Destinations

Member Serialization

Serialization at times throws curious situations that makes us look beyond the normal usages. Here is another situation that took sometime to find a solution for. Let's examine the following code. What would be the output if one was to serialize an instance of the Test class ? Let's examine the output Not surprising right … Continue reading Member Serialization