petyka
❔ Issue with IOptions when using private getter
Hi,
I have an issue using IOptions. I have a config value (let's call it Config1), which is a list of strings. Unfortunately this config value is stored like this: "str1|str2|str3", and I have to manually transform it, so I can use it like a list.
My first idea was to have a property, public string Config1, with no getter, and the setter would do the transformation, and save the data to another property, public IEnumerable<string> RealConfig1. My issue is that if I don't have a getter, or I have private get, the config value won't be bound.
So this works:
public string Config1
{
get;
set;
}
but this doesn't:
public string Config1
{
private get;
set;
}
The values are coming from Azure App Configuration, we use net6.
Do you have any idea why does it not work? I don't want to have these as public, gettable properties, as other devs who are not familiar with the codebase might get into trouble using it later.13 replies