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
External Tracker for OxyPlot
Back with another hack with Oxyplot. This time around what I would like to achieve is to actively update a TextBlock with Tracker values as the user moves around the graph. This could be useful when you want to have an external mini-dashboard which would the tracker values as User works on the graph after … Continue reading External Tracker for OxyPlot
Json : Fetch all keys using Linq
Given a Json, how do we get all the keys in it ? Just the keys. For example, Consider the Json below. Given the above Json, you would like to get all the keys. You might be later interested to show this as a Menu or Dropdown, that's down to the requirements. But, how do … Continue reading Json : Fetch all keys using Linq
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
Linq Join on Like%
One of the recent requirements I came across recently needed what looks like a Join on a 'Like%'. Let me cite an example to demonstrate the requirement. Consider the Collections below. Master Collection ID Name 1 Jia Anu 2 Sreena Anu 3 Anu Viswan Child Collection ID First Name Age 1 Jia 2 3 Sreena … Continue reading Linq Join on Like%
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