JsonHelperSerializeT(T, JsonSerializerOptions) Method

Returns a Json string of the provided object type.

Definition

Namespace: Common.Core.Classes
Assembly: Common.Core (in Common.Core.dll) Version: 2.1.5
C#
public static string? Serialize<T>(
	T obj,
	JsonSerializerOptions? options = null
)
where T : class

Parameters

obj  T
Object to serialize.
options  JsonSerializerOptions  (Optional)
Optional Json serializer options.

Type Parameters

T
Generic class or interface.

Return Value

String
is returned if the serialization fails.

Exceptions

NotSupportedExceptionThrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.

See Also