Extension method for writing a Type as a JSON value

This commit is contained in:
Chris Cameron
2018-02-15 14:44:21 -05:00
parent cc34bcb19e
commit 29e1ef82bb

View File

@@ -34,6 +34,21 @@ namespace ICD.Common.Utils.Extensions
jObject.WriteTo(extends, converter);
}
/// <summary>
/// Writes the type value.
/// </summary>
/// <param name="extends"></param>
/// <param name="type"></param>
[PublicAPI]
public static void WriteType(this JsonWriter extends, Type type)
{
if (extends == null)
throw new ArgumentNullException("extends");
string assemblyName = type == null ? null : type.AssemblyQualifiedName;
extends.WriteValue(assemblyName);
}
/// <summary>
/// Gets the current value as an integer.
/// </summary>