Skip to content

Instantly share code, notes, and snippets.

@n074v41l4bl34u
n074v41l4bl34u / FSharpOptionConverter.cs
Created March 5, 2016 20:26 — forked from NickJosevski/FSharpOptionConverter.cs
FSharpOptionConverter : JsonConverter
public class FSharpOptionConverter : JsonConverter
{
private static MethodInfo _getInnerValue = typeof (FSharpOptionConverter).GetMethod("GetInnerValue",
BindingFlags.Instance |
BindingFlags.NonPublic);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value != null)
{
var optionValueType = value.GetType().GetGenericArguments().Single();