- Home /
Search array by variables.
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?
Answer by dannyskim · May 17, 2012 at 08:47 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:
ilu <3
Heheh, this will be very handy indeed. I quite understand the grammar of C# fluently, it's just my vocabulary that needs work.
Your answer
Follow this Question
Related Questions
Finding A Variable With A String Variable 1 Answer
Storing many array values in a variable 1 Answer
Enumerations Varibles 1 Answer
Saving/Loading variables 1 Answer
Storing a variable and it's name 3 Answers