thanks for the response. I do have some code working but will give it a try.
I converted the application from a windows to a console app as I need to
schedule it to run through sql server agent. Anyhow I am getting the error
on two methods now with the console app, worked fine in the windows app. The
error is (an object reference is required for the non static field, method or
property). This occures on the line were I call a method that I am passing 4
string lists into, so looks like
method2(emails, reports, names, days).
any ideas.
--
Paul G
Software engineer.
"Göran Andersson" wrote:
Paul wrote:
Hi thanks for the response. Still using vs2005, ended up just going through
the list and if in second list do nothing, else add to second list. The
second list is the one that ends up with just the unique values.
That doesn't scale very well, as checking if the list contains a value
gets considerably slower as the list grows. You should use a dictionary
for checking if the values exist or not:
Dictionary<int, intunique = new Dictionary<int, int>();
foreach (int value in listofobjects) {
if (unique.ContainsKey(value)) {
// counts occurances - you can skip this if you don't want it:
unique[value]++;
} else {
unique.Add(value, 1);
}
}
--
Göran Andersson
_____
http://www.guffa.com