Esempio n. 1
0
 internal static TEnum GetValue <TEnum>(
     this OptionalMember <TEnum> instance,
     MissingMemberBehavior missingMemberBehavior
     ) where TEnum : struct, Enum =>
 instance.Select(
     value => missingMemberBehavior == MissingMemberBehavior.Error
             ? Parse <TEnum>(value.GetStringRequired())
     : TryHardParse <TEnum>(value.GetStringRequired())
     );
Esempio n. 2
0
 internal static TEnum GetValue <TEnum>(this OptionalMember <TEnum> instance)
     where TEnum : struct, Enum =>
 instance.Select(value => Parse <TEnum>(value.GetStringRequired()));
Esempio n. 3
0
 internal static string GetValueOrEmpty(this OptionalMember <string> instance) =>
 instance.Select(json => json.GetString()) ?? "";
Esempio n. 4
0
 internal static bool GetValue(this OptionalMember <bool> instance) =>
 instance.Select(json => json.GetBoolean());
Esempio n. 5
0
 internal static string?GetValueOrNull(this OptionalMember <string> instance) =>
 instance.Select(json => json.GetString());