Generic.List

S

shapper

Hello,

I have a Generic.List(Of MyClass)

MyClass has two properties: ID and Value, both strings.

I want to look for the item, in my Generic.List(Of MyClass), with a
given ID.

How can I do this?

Thanks,

Miguel
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

shapper said:
Hello,

I have a Generic.List(Of MyClass)

MyClass has two properties: ID and Value, both strings.

I want to look for the item, in my Generic.List(Of MyClass), with a
given ID.

How can I do this?

By looping through the list and looking for the id.

If you would use a Dictionary<sring, MyClass> instead, and using the ID
as key, you would be able to get the item directly.
 

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

Similar Threads

Dataset to Generic.List(Of MyClass) 4
Generic.List 1
Property. Which one should I use? 3
String and Class 3
CheckBox 1
String 3
Find Control 1
Array 1

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,224
Latest member
BettieToom

Latest Threads

Top