I have an array of Item with different variables, such as Weight, Value, Name, and junk like that. I know how to use Array.Find() and Array.FindAll() using a boolean predicate, but how would I go about specifically finding an Item by its variable?
For example, I want to have a function that can find specific items. public Item GetItem(string itemName) for example, would find the first Item named itemName.
What is the most efficient way to do that?
asked May 17 '12 at 08:26 PM
You're probably wanting to use something like a LIST if you want that added functionality. If you're using C#, learning how to use LINQ to form queries is extremely useful and easy to learn as well.
A good tutorial for getting started with LINQ would be the following link, by Prime31: