IList<> Question

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi,

I have a simple Product Domain Entity class with just fields/properties. I
have a IList<Product> that I need to search for a particular Product object
based on a field/property ProductID. The only solution I could come up with
is a method that loops through the IList<Product> (foreach) and looks at
each ProductID and returning the Product with the matching ProductID. Is
this the best solution?

Thanks
 
Hi,

Wanjun said:
Using Hashtable should be more efficient (for searching).

Wanjun

Or, with generics, a Dictionary<string, Product> where the key (the
"string") is the ProductID.

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top