My appsettings json file
{
"AppSettings": {
"contractInfo": [
{ "contract1": "01/11/2020"},
{ "contract2": "29/07/2021"},
{ "contract3": "15/10/2021"},
{ "contract4": "15/02/2021"}
]
}
}
I have a seperate config class.
public ConfigHelper(IConfiguration configuration)
{
_configuration = configuration;
}
public string GetConfigValue(string key)
{
var value = _configuration["AppSettings:" + key];
return !string.IsNullOrEmpty(value) ? Convert.ToString(value) : string.Empty;
}
Contract Info is as key value pair,where the key is the contarct name and the value is the contract end date.
How can I read the end date of the particular contract without using a for loop from the appsettings.json file.(That is, if we get the contract name as "contract 3" from the database,I want to read the contract end date of contract 3 from the appsettingsjson without using a for loop)
Any help is appreciated. Thankyou.