tags:

views:

27

answers:

1
string output = (from s in abc.longs
                         group s by DateTime.FromFileTimeUtc(s).Minutes < 1
                 .... // so on so forth

The question I have, is I do "DateTime.FromFileTimeUtc(s) like 10 times here, is there any way to do

from s in abc.longs
   t = DateTime.FromFileTimeUtc(s).Minutes
   group by t < 1
+2  A: 

Yes, using the let keyword, which let you declare a symbol you can use later on in the query:

from s in abc.longs
let t = DateTime.FromFileTimeUtc(s).Minutes
group by t < 1

You can find a lot of examples using Google.

driis
or even Bing :-)
mjsabby