Tony,
If the ordering of elements is not important to you you can use Hastable
instead. Hastables registers elements under some key value. You can use
latter on the key to extract the element.
Hashtable ht = new Hashtable()
ht[test.name] = test;
ht["Nisse"] will return the object which proeprty name was Nisse.
Keep in mind that keys cannot duplicate as well as if you change the *name*
property after the object has been added to the hashtable trying to retrieve
the item using the new name won't work. The element needs to be re-added
upon changing the name.
--
HTH
Stoitcho Goutsev (100)
"tony" <jo*****************@telia.comwrote in message
news:Oo**************@TK2MSFTNGP06.phx.gbl...
Hello!
Assume I have created several object of a class called Test and then used
add all these Test object to an ArrayList.
Assume also that in this class Test I have a field with a property called
name.
Assume I add a Test object where the name field is equal to "Nisse"
Now to my question:
Is it possible to find if there exist an object in the ArrayList with the
name="Nisse"
//Tony