JsonHelperReadAppSettings Method

Returns a collection of settings from a Json application settings file.

Definition

Namespace: Common.Core.Classes
Assembly: Common.Core (in Common.Core.dll) Version: 2.1.5
C#
public static Dictionary<string, string?> ReadAppSettings(
	ref string fileName,
	ref string?? section,
	int maxDepth = 2
)

Parameters

fileName  String
Json application settings file name.
section  String
Application settings section to return (case-sensitive).
maxDepth  Int32  (Optional)
Maximum depth allowed when parsing JSON data.

Return Value

DictionaryString, String
An empty collection is returned if the settings section could not be found.

Remarks

If no section is provided it is assumed that the settings are in the root.
Otherwise it is assumed that the section name is case-sensitive and only 3 levels deep.

See Also