Skip to content

Instantly share code, notes, and snippets.

@andrewjw1995
andrewjw1995 / TaggedUnionConverter.cs
Last active April 18, 2018 03:38
A JsonConverter that allows implementations for an interface or abstract class to be chosen based on a discriminating property
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.