One of the recent questions that was intriguing (for me) in Stackoverflow was the need to Process a List and while displaying the result, display only the properties that are decorated with a specific attribute. Let me explain with an example. Consider the following Entity. For a List<Employee>, the expected result would display only "BusinessVertical", … Continue reading Filter List and Display Type members with specified attribute
Mapping XML Using Automapper
Automapper comes handy when you have to deal with a lot of DTOs, making it very easy to map one type to another. But there are situations where you might need an extra hand. Consider the following Type definitions. The Source.Address is a XML representation of Address. Your requirement is to configure Automapper to convert … Continue reading Mapping XML Using Automapper
Json Recipes
Here are few quick recipes with Newtonsoft.Json Recipe 01 : Convert Json to XML One way to convert a Json to XML would be to convert Json to intermediate class structure and then serialize the class using XMLSerializer. But why go the long way when you can do it directly. Let's check the code straightaway. … Continue reading Json Recipes
Verifying if View Exists for specified ViewModel
There might raise situations in your Project where you might be interested to check if the ViewModel specified has a corresponding View defined and gradefully handle the error, than throwing an exception. Caliburn Micro's ViewLocator class provides you methods that enables you to do exactly that.
Shaders with HLSL #03: Passing Additional Parameters
In previous parts of this series, we briefly discussed the need for Shaders and created our first Shader Program. In this subsequent part, we would be exploring on passing additional parameters to our Custom Shader. In previous example, we replaced entire color of applied Control with a single color. What if we need to replace … Continue reading Shaders with HLSL #03: Passing Additional Parameters
Assignment using Ternary Operator
Couple of days back, I happened to come across a question in StackOverflow. Question seemed pretty straightforward, but at the same time, interesting. How would one use ternary operator for assignment. For example, how would write following code using ternary operator. Obviously, following wouldn't work. One way to use ternary operator would using Action. But … Continue reading Assignment using Ternary Operator
C# 8.0 : Default Implementation of Interface Members
The way C# language is evolving is definitely exciting and one feature that truly makes the wait for C# 8.0 all the more exciting is default implementation of interfaces. Since the onset, interfaces were behaviors characterized by member signatures, strictly disallowing any implementation. All that is going to change when C# 8.0 rolls out, as … Continue reading C# 8.0 : Default Implementation of Interface Members
Shaders with HLSL #02 : Applying Shader to WPF Application
In the first part of series, we wrote our first Shader Program. Now it is time to compile it so that we could use it in our WPF Application. HLSL Compiler To compile your HLSL code to a format that could be used with .Net WPF application, you would require the fxc compiler. For Windows … Continue reading Shaders with HLSL #02 : Applying Shader to WPF Application
Shaders with HLSL #01 : Shaders with HLSL for WPF Developers
Complete Tutorial Series Shaders with HLSL #01 : Introduction to Shaders and HLSL Shaders with HLSL #02 : Applying Shader to WPF Application Shaders with HLSL #03 : Passing Additional Parameters In this first part of our tutorial, we will briefly enlighten ourselves on key concepts involving shaders and why it is required. We will also … Continue reading Shaders with HLSL #01 : Shaders with HLSL for WPF Developers
Early Exceptions for Iterator and async Methods
One of the first things you would need to be vary of while working with Iterator methods and async methods is exception handling. Both Iterator methods and async methods delay the execution of your code, right until you need the result, but it also results in delayed exceptions. Late Exception With Iterator Methods Let's consider … Continue reading Early Exceptions for Iterator and async Methods