mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 13:45:05 +00:00
feat: Extension method for reading JSON token as a Guid
This commit is contained in:
@@ -190,6 +190,21 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
return (T)(object)extends.GetValueAsInt();
|
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>
|
/// <summary>
|
||||||
/// Deserializes an array of items from the reader's current value.
|
/// Deserializes an array of items from the reader's current value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user