JObjectExtension.GetEnum method

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Json.Extensions
Assembly Skybrud.Essentials.dll

GetEnum<T>(JObject, string)

Static

Gets an enum of type T from the token matching the specified path.

public static T GetEnum<T>(JObject obj, string path)

Type Parameters

T

The type of the enum.

Parameters

obj JObject

The instance of JObject .

path String

A String that contains a JPath expression.

Returns

T

An instance of T.

GetEnum<T>(JObject, string, T)

Static

Gets an enum of type T from the token matching the specified path.

public static T GetEnum<T>(JObject obj, string path, T fallback)

Type Parameters

T

The type of the enum.

Parameters

obj JObject

The instance of JObject .

path String

A String that contains a JPath expression.

fallback T

The fallback value if the value in the JSON couldn't be parsed.

Returns

T