I have a getvalue
object that contains a price list which consists of 5 items. I need to get the value of one of the elements. I can get the value by index:
You could do this by adding an indexer property to the ValuationPrices
type.
public ValuationPrice this[string name]
{
get
{
return this.First(n => n.Name == value);
}
}
Then you would be able to write getvalue1.ValuationPrices["fieldName"]
.
The implementation of the indexer property will vary depending on the internal structure of your classes, but hopefully this gives you some idea of the syntax used to implement the indexer.