I have a simple class:
public class MyClass { public string MyClassName { get; private set; } public string MyClassValue { get; private set; } }
And I want to save an array of MyClass objects as follows:
MyClass[] myClasses = new MyClass[5];
Is it possible, without creating a collection object, to be able to access one of these objects in an array of objects using a row indexer (is this the correct terminology)?
For example, if myClasses [2] has the value "andegre" in the MyClassName property, how can I access it like this:
MyClass andegre = myClasses["andegre"];
Instead of doing something like:
MyClass andegre = myClasses[GetIndexOfOfMyClassName("andegre")];
TIA
source share