Sunday 15 September 2013

c# - Pull elements from array with property value under or over X -


I have a very large list of custom classes. I often need to do an action based on only elements from that list where a custom value of the class is more than or less than a specific limit.

Currently, I do something like this:

  // Organize a custom list with your X value (sometimes descending, sometimes descending) customList. Sort ((a, b) = & gt; bxcompareto (ax)); // unless the x value is not necessary (int i = 0; i   

This is not a major hurdle, but it would be best if I can speed up this kind of work for this application (I do not always mention this way Want to learn)

The question is whether it is a fast sorting method without writing yourself and / or a faster way to run PerformTask on elements that meet specific criteria without any movement is?

My questions can also be asked about not only adding / removing items but also keeping a list organized, but changing them even when changing values ​​... < P> Thank you, Tim

Sorting here is a wrong view of this (n log n) very efficient algorithms Where is the custom item in the custom item (n = & gt; nx> 0.5f)) {PerformTask (items). enumerable.where :

  foreach ); }    

No comments:

Post a Comment