Arraylist problem

Jul 25 2006 7:50 AM
Hey

i'm still pretty new to C# so.. I'll try to explain my problem.

I have and Arraylist wich contains a certain amount of objects, wich i call articles. Each of these articles has his own Article ID or shorter aid.

Now i'd like to check if a certain article with that ID is already assigned to the arraylist.

Here is some code:

//Declaring arraylist private ArrayList artikelen; //Adding an article to the arraylist public void addArtikel(int aid) { //The aid constructor is used, wich gets some values from a database according to this aid. artikelen.Add(new Artikel(aid)); } //Checking if the article already exists in the arraylist? public Boolean articleExists(int aid) { artikelen.BinarySearch ???? }

Thanks Thomas

Answers (1)