How to speed up your webpages (Joke)


I made a method to run a lot of heavy processing tasks in parallel, and made a minor mistake causing quite long page times. Can you see the problem?

 public async static Task<IOrderedEnumerable<SLDetails>> GetDetails(this IEnumerable<SLObject> Objs, DateTime Start, DateTime End) { var Tasks = Objs.Select(o => new Task<SLDetails>(() => o.GetDetails(Start, End))); await Task.WhenAll(Tasks); return Tasks.Select(o => o.Result).OrderBy(o => o.Name); } 

I got a kick out of it.

by XtremeOwnage via /r/csharp

Leave a Reply