Law Of Demeter

If you ask any Software Developer, he would vouch that separation of concerns is the fundamental principles for maintaining any complex system and one of the vital links for achieving Separation of Concerns is decoupling. Law of Demeter (LoD), also known as Principle of least knowledge, intends to reduce coupling between objects as proposed by … Continue reading Law Of Demeter

Json Custom Filtering : Remove Properties of a Type T

One of the recent questions that came up in SO which fascinated me was how do one filter a Json string by removing properties from Json, which is of a particular Type. For example, consider the following Json. What if you want to remove all Json Properties that has a value of Integer Type. What … Continue reading Json Custom Filtering : Remove Properties of a Type T

Enumerable.Empty vs new T[0]

The need for creating an Empty array/collection rises quite often in most applications. This, normally presents us with two options. Using the Constructor, new T[0]; Using the extension method, Enumerable.Empty Let's dive a bit deeper into both and examine how both these options work and differ. Using new T[0] Creating an empty array with Array … Continue reading Enumerable.Empty vs new T[0]

Evil Code #008: Property Instance

It has been long since I blogged on Evil Code series. Time to check one again now. Consider two samples of code. Sample 1 Sample 2 How differently would two of the code samples given below behave ? Well, Sample 1 compiles and Sample 2 doesn't. Why ?? Sample 2, in fact raises following error. … Continue reading Evil Code #008: Property Instance

Exploring Randomize.Net

Randomize.Net provides an easy and lightweight extensions for System.Random for creating random instances of any given Type T, with generated random value. This can be highly useful for generating POCO's to test your sample code, including LINQ queries against. The API has been designed to make it extremely simple and devoid of any complex syntax. … Continue reading Exploring Randomize.Net

Mock RestClient.ExecuteAsync

RestSharp is not a stranger to developers, so is the usage. What this posts aims to explore is how to do Unit Test a method, involving a RestClient.ExecuteAsync call. To be more precise, the post explores how to mock the RestClient for the method. Let's consider the following code, taken from VSPostman, one of the … Continue reading Mock RestClient.ExecuteAsync

Caliburn.Micro #008: Gesture Recognition using Short-Hand Syntax

In this part of Caliburn.Micro tutorials we would explore how to configure and use Gesture Recognition with Caliburn.Micro, particularly exploiting the Short-Hand syntax for Actions. Caliburn.Micro doesn't support this out of the box, so obviously we need to work around the Actions to provide support for Gestures. Let's first formulate the syntax of how we … Continue reading Caliburn.Micro #008: Gesture Recognition using Short-Hand Syntax