I have a Gain class and a list of this class filled with data:
internal class Gain {
internal string asset { get; set; }
internal float amount { get; set; }
internal float cost { get; set; }
}
private static List<Gain> Gains = new List<Gain>();
The user can send string commands, like "AssetName" or "amount", to get specific data.
string asset="AssetName";
string datatype="amount"; // or "cost" etc
In C#, is there a compact syntax to select the specific data for a specific asset in the Gains list in just one line, like:
return Gains[AssetName].[datatype]; // or something like this