Пример #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())
     );
Пример #2
0
 internal static TEnum GetValue <TEnum>(this OptionalMember <TEnum> instance)
     where TEnum : struct, Enum =>
 instance.Select(value => Parse <TEnum>(value.GetStringRequired()));
Пример #3
0
 internal static string GetValueOrEmpty(this OptionalMember <string> instance) =>
 instance.Select(json => json.GetString()) ?? "";
Пример #4
0
 internal static bool GetValue(this OptionalMember <bool> instance) =>
 instance.Select(json => json.GetBoolean());
Пример #5
0
 internal static string?GetValueOrNull(this OptionalMember <string> instance) =>
 instance.Select(json => json.GetString());