feat: Extension method for reading JSON token as a Guid

This commit is contained in:
Chris Cameron
2019-01-30 10:52:44 -05:00
parent 196c2a535a
commit 5fb7636ed4

View File

@@ -190,6 +190,21 @@ namespace ICD.Common.Utils.Extensions
return (T)(object)extends.GetValueAsInt();
}
/// <summary>
/// Gets the current value as a guid.
/// </summary>
/// <param name="extends"></param>
/// <returns></returns>
[PublicAPI]
public static Guid GetValueAsGuid(this JsonReader extends)
{
if (extends == null)
throw new ArgumentNullException("extends");
string stringValue = extends.GetValueAsString();
return new Guid(stringValue);
}
/// <summary>
/// Deserializes an array of items from the reader's current value.
/// </summary>