mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-13 03:35:04 +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();
|
||||
}
|
||||
|
||||
/// <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>
|
||||
|
||||
Reference in New Issue
Block a user