Newbie learning LINQ…

Expectation (tutorial):

var q = from p in Products where p.Color == "Blue" select p; 

Reality (Visual Studio):

int ColorIndex = 1; var q = from p in Products.AsEnumerable().AsQueryable().AsCollectable() where p.ItemArray[ColorIndex].Field<typeof("String")>(ColorIndex).ToString() == "Blue" select p; 

Performance test:

Old good SQL = 0.003 sec

LINQ = 519 yrs 4 mths 23 days 3 hrs 17 mins 4 secs

I love keeping updated on new technologies.

by twcsharpie via /r/csharp

Leave a Reply