List<>.Exists()???



Hi,
I don't get this method... Could someone please explain it?

I have a number generator where I want to add the numbers to a List<long>.
Before I add each number, I want to make sure that the number does not
already exist. Sample code:

List<long> numlist = new List<long>();
long newNumber = generator.New(); // generates the new number

if (!numlist.Exists(newNumber)) // obviously does not work, that's my
problem.
numlist.Add(newNumber);

Can anyone help me?

Thank you in advance.


.


Loading