JsonHelperDeserializeFileT Method

Reads a Json file and populates an object.

Definition

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

Parameters

fileName  String
Json file name.
options  JsonSerializerOptions  (Optional)
Optional Json serializer options.

Type Parameters

T
Generic class or interface.

Return Value

T
is returned if the object could not be populated.

Exceptions

ArgumentExceptionThrown when one of the arguments provided to a method is not valid.
IOExceptionThrown when an I/O error occurs.
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.
OutOfMemoryExceptionThrown when there is not enough memory to continue.
SecurityExceptionThrown when a security error is detected.
UnauthorizedAccessExceptionThrown when the operating system denies access because of an I/O error or a specific type of security error.

See Also