which collection should I use

Posted by Masna on Stack Overflow See other posts from Stack Overflow or by Masna
Published on 2010-05-23T17:03:57Z Indexed on 2010/05/23 17:10 UTC
Read the original article Hit count: 316

Filed under:
|
|
|

Hello,

I have a number of custom objects of type X. X has a number of parameters and must be unique in the collection. (I created my own equals method based on the custom parameters to examine this) In each object of type x, I have a list of objects y. I want to add/remove/modify easily an object y.

For example:

To write the add method, it would be something like add(objTypeX, objTypeY) I would check or the collections already has a objTypeX. If so: i would add the objTypeY to the already existing objTypeX else: i would create objTypeX and add objTypeY to this object.

To modify an objTypeY, it would be something like(objTypeX, objTypeY, newobjTypeY) I would get objTypeX out of the collections and modify objTypeY to newobjTypeY

Which collections should I use? I tried with hashset but i can get a specific object out of the list, without run down the list till I find that object.

I develop this in vb.net 3.5

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net