Common interface to access to configurations value.
Install-Package microservice.toolkit.configuration.extensions -Version 2.1.0
dotnet add package microservice.toolkit.configuration.extensions --version 2.1.0
<PackageReference Include="microservice.toolkit.configuration.extensions" Version="2.1.0" />
bool GetBool(string key);
Tries to retrieve the boolean value of the entry with key. Returns false if not exists.
string GetString(string key);
Tries to retrieve the string value of the entry with key. Returns null if not exists.
int GetInt(string key);
Tries to retrieve the integer value of the entry with key. Returns 0 if not exists.
string[] GetStringArray(string key);
Tries to retrieve the value (array of string) of the entry with key. Returns default value if not exists.
int[] GetIntArray(string key);
Tries to retrieve the value (int of string) of the entry with key. Returns default value if not exists.
using microservice.toolkit.configuration.extensions.extension;
IConfiguration configuration = ...;
var stringValue = configuration.GetString("stringValue");