How to serialize and deserialize objects using NewtonSoft JSON

Some instructions on how to use Newtonsoft JSON to serialize and deserialize your objects in C# Step 1: Create a new Visual Studio project Just a simple console application will do: Step 2: Install Newtonsoft Json using Nuget Available at the NuGet site: https://www.nuget.org/packages/newtonsoft.json/ Enter the command to install Newtonsoft Json in the Visual Studio …

Continue reading ‘How to serialize and deserialize objects using NewtonSoft JSON’ »

Refactoring conditional statements using polymorphism in C#

Suppose you have a conditional statement such as a switch or if-else that performs various actions depending on an object’s type: It is often beneficial to try to avoid lengthy switch/if-else constructions. This post demonstrates how these can be refactored using polymorphism. Consider the following Employee class which uses a conditional statement to return a …

Continue reading ‘Refactoring conditional statements using polymorphism in C#’ »

Using the Appccelerate state machine to navigate between WPF XAML views

A post describing how to utilise Appccelerate as a means of employing a state machine in your MVVM / WPF application. Implementing state machines using the state pattern can lead to complicated code. A state machine software component that allows us to implement a state machine as a single class is a significant step towards …

Continue reading ‘Using the Appccelerate state machine to navigate between WPF XAML views’ »