JsonValueExtensionsToJsonTEnum(NullableTEnum, JsonEnumFormat, String) Method
Namespace: KGySoft.JsonAssembly: KGySoft.Json (in KGySoft.Json.dll) Version: 3.0.0
public static JsonValue ToJson<TEnum>(
this TEnum? value,
JsonEnumFormat format = JsonEnumFormat.PascalCase,
string? flagsSeparator = null
)
where TEnum : struct, new()
<ExtensionAttribute>
Public Shared Function ToJson(Of TEnum As {Structure, New}) (
value As TEnum?,
Optional format As JsonEnumFormat = JsonEnumFormat.PascalCase,
Optional flagsSeparator As String = Nothing
) As JsonValue
public:
[ExtensionAttribute]
generic<typename TEnum>
where TEnum : value class, gcnew()
static JsonValue ToJson(
Nullable<TEnum> value,
JsonEnumFormat format = JsonEnumFormat::PascalCase,
String^ flagsSeparator = nullptr
)
[<ExtensionAttribute>]
static member ToJson :
value : Nullable<'TEnum> *
?format : JsonEnumFormat *
?flagsSeparator : string
(* Defaults:
let _format = defaultArg format JsonEnumFormat.PascalCase
let _flagsSeparator = defaultArg flagsSeparator null
*)
-> JsonValue when 'TEnum : struct, new()
- value NullableTEnum
- The value to convert.
- format JsonEnumFormat (Optional)
- Specifies the format of the enum in the JSON value. This parameter is optional.
Default value: PascalCase. - flagsSeparator String (Optional)
- Specifies the separator if value consists of multiple flags. This parameter is optional.
Default value: , which uses the default ", " separator.
- TEnum
- The type of the enumeration. Must be an Enum type.
JsonValueA
JsonValue instance that is the JSON representation of the specified
value.In Visual Basic and C#, you can call this method as an instance method on any object of type
NullableTEnum. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).