Timeline for Sorting a list of first names from a text file
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 3, 2015 at 14:10 | comment | added | Jodrell |
There are two overloads for Select , the seconds accepts a delegate Function<T, int> instead of just Function<T> . Select will pass an int as the second parameter, starting with 0 and adding one 1 with each call. Essentially, it passes the index to your lambda, although it is zero based. Am I making sense?
|
|
Aug 3, 2015 at 13:02 | history | edited | Jens | CC BY-SA 3.0 |
added 145 characters in body
|
Aug 3, 2015 at 12:38 | history | edited | Jens | CC BY-SA 3.0 |
deleted 60 characters in body
|
Aug 3, 2015 at 12:35 | comment | added | Jens |
@Jodrell very nice and helpful tips - i realy should join codereview more often! Can you explain the Select overload? i do not get it. ReSharper and StyleCop is so powerful.
|
|
Aug 3, 2015 at 12:28 | comment | added | Jodrell | I too use Reshaper, with the StyleCop plugin. Can affirm your reccomendation. | |
Aug 3, 2015 at 12:26 | comment | added | Jodrell |
if you use the other overload of Select you can avoid the ToList and associated memory allocation. msdn.microsoft.com/en-us/library/vstudio/…
|
|
Aug 3, 2015 at 12:26 | history | edited | Jens | CC BY-SA 3.0 |
deleted 89 characters in body
|
Aug 3, 2015 at 12:23 | comment | added | Jodrell |
If you make your char to value function handle both upper and lower case, you can avoid the extra iteration for ToLower .
|
|
Aug 3, 2015 at 12:21 | comment | added | Jodrell |
If you use StringSplitOptions.RemoveEmptyEntries , like in my answer, you can avoid the need for the Replace s.
|
|
Aug 3, 2015 at 12:18 | comment | added | Jens |
@Jodrell yeah - nice idea. i will change that. For all that are reading this: the code was: Stopwatch sw = new Stopwatch(); sw.Start();
|
|
Aug 3, 2015 at 12:16 | history | edited | Jens | CC BY-SA 3.0 |
added 345 characters in body
|
Aug 3, 2015 at 12:16 | comment | added | Jodrell |
use StopWatch.StartNew msdn.microsoft.com/en-us/library/bb46x3x1(v=vs.110).aspx
|
|
Aug 3, 2015 at 12:12 | history | answered | Jens | CC BY-SA 3.0 |