Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Williamson andrewjw1995

View GitHub Profile
@andrewjw1995
andrewjw1995 / TaggedUnionConverter.cs
Last active Apr 18, 2018
A JsonConverter that allows implementations for an interface or abstract class to be chosen based on a discriminating property
View TaggedUnionConverter.cs
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace Utilities
{
/// <summary>
/// Allows interfaces to be deserialized by creating a concrete implementation, based on some discriminating key in
/// the interface.