Is it possible to access an enumerated collection of objects by parameter value instead of by index? RRS feed

  • Question

  • Say I have a collection of custom objects.  each object has two string parameters one called Name, the other called Value.  Also say I put these objects into a collection like  List<myObject> myObjects

    Assuming each Name is unique, is there a way to access directly the object by saying something like Name.Value instead of doing the for loop and searching for the correct name one by one to get say myObjects[3].Value?

    • Edited by sjs1978 Thursday, September 13, 2012 12:26 AM
    Thursday, September 13, 2012 12:25 AM