<RANT>
Quote:
Originally Posted by TheMiszczu
LINQ is slower than loop,
|
First mistake, The JIT will compile most LINQ statements to loops and will actually optimize them to kingdom come. The first time the LINQ runs, yes, it will be slow, but after that the time difference between a LINQ call and a for loop is less than 3 ticks. Infact, a LINQ query is faster than a foreach loop in most instances.
I couldn't imagine writing functions to find the first item in a collection in a for loop. The C# Compiler will actually use functions to optimize the searching of collections when used with an enumerator (eg. LINQ).
Quote:
Originally Posted by TheMiszczu
also lock using is bad idea.
|
ARE YOU CRAZY?!?! Try writing the same code but without locks. You will get 100000 exceptions due to the collection changing whilst it's enumerating. Locks are like the first thing any programmer should use, even if you aren't managing LINQ queries! Sure, locks aren't needed in single thread applications, but because the "paint" function is run on the GUI thread and the Receiver is run on a separate thread, you NEED locks.
</RANT>
-jD