I have a class called InstrumentConfigValues with properties that has type implementing an interface. Now I have an enum by name InstrumentConfig which has set of values. These values are like keys inside the json file. I want to map something like [JsonProperty(InstrumentConfig.LowDiskpace.ToString()].
For some reason its not allowing this and complains saying:
An attribute argument must be constant expression
I referred to many post specifically JsonStringEnumConverter. But how can I map each property with the enum key. I also saw this post JsonSerializationSettings but not able to correlate to my problem. Please help/
public class InstrumentConfigValues : IInstrumentConfig
{      
    public double SpaceNeededForSingleRun
    {
        get; set;
    }
    public int NumberOfInputSlots
    {
        get; set;
    }
    public int SupportedChannelCount
    {
        get; set;
    }
}
//I want this inheritance as some other class wants to access the values.
public abstract class InstrumentConfigReadWrite : InstrumentConfigValues
{
    protected ReturnCodes PopulateValuesFromJObject(JObject jObject, string path)
    {
        try
        {
            if (JsonConvert.DeserializeObject<InstrumentConfigValues>(jObject.ToString()) == null)
            {
                return ReturnCodes.ErrorReadingFile;
            }
        }
        catch (JsonSerializationException jex)
        {
            SystemDebugLogLogger.LogException(jex, "Invalid Instrument Config File Values. Data needs to be copied over.");
            return ReturnCodes.ErrorReadingFile;
        }
        return ReturnCodes.Success;
    }
}
 
     
    