I have a QoL problem that i can figure out myself. See my below code with some explenations
public void UpdateStock(long? instID, float? Value, int counter,string KpiName)
{
{
List<KpiReturn> updateKpi = new List<KpiReturn>();
updateKpi.Add(new KpiReturn { instID = instID, KpiName = Value });
}
}
And a class with my properties looking like this:
public partial class KpiReturn
{
public long? instID { get; set; }
public double? peValue { get; set; }
public double? psValue { get; set; }
public double? pbValue { get; set; }
}
This code wont work because my kpiReturn dosent have a definition for "KpiName" Right now i run 3 different if statements based on if i want the peValue,psValue,pbValue. But i want to add many more properties to this.
in the void UpdateStock code attached i have passed the string "psValue" to the KpiName.
is there any way that i can do to make the program understand that in the code
updateKpi.Add(new KpiReturn { instID = instID, KpiName = Value }
i want to pass the kpiName value instead of the actual name "kpiName"? ie psValue,pbValue or peValue