Click here to Skip to main content
15,885,435 members

Comments by Jimmanuel (Top 16 by date)

Jimmanuel 23-Nov-11 20:59pm View    
IOrderedEnumerable because that's what OrderBy returns. Read the docs.

(i => i) is the sort function passed to OrderBy that tells it how to sort the elements in teh Linked List. When you access an element it gives you double you put in for that element so this will tell OrderBy to sort the values (1, 0.49).
Jimmanuel 27-Oct-11 16:20pm View    
This probably won't improve the performance much so I'll post as a comment instead of solution.

ArrayLists have been obsolete since .Net 2.0. A List is the preferred method; in addition to the strong typing the generics also perform better on value types which will probably help you out a little.

Also, if you know a rough estimate of how many items are in the spreadsheet you can declare the List with an initial capacity so that hopefully it won't need to be resized from all the Adds.
Jimmanuel 26-Oct-11 15:41pm View    
>> Is there a better way to do this?

That depends on exactly what you want to do. The Thread Pool is used for work items that need to be processed but it doesn't matter exactly when as long as it's in the near future. Items should generally be short and not block so as to not waste the existence of the thread. Tasks and Parallel use the Thread Pool under the hood but give you a nicer wrapper to handle exceptions and waiting for things to complete.

Dedicated threads are more useful if you need to block a lot, execute something right now or need more fine grained control of the threads in your app.

I believe you said this was a contrived example (at least I hope it is) so what you need to use depends on what you're trying to accomplish.
Jimmanuel 28-Sep-11 14:48pm View    
If you're implementing the Async method yourself then yes it's possible, but more info would be needed to diagnose your exact problem. What's the error? More code please.
Jimmanuel 8-Dec-10 7:05am View    
RE: the question you posted to my comment

"Manually convert" means allocate the float[,] that you want to return and then loop through the list of lists and copy each element into it. That's "manual" to me because it involves allocating, looping and casting to get it done rather than simply calling ToArray to do all of that for you.