Last active
December 14, 2015 23:39
-
-
Save GregRos/5167357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x = | |
from blah in Enumerable.Range(0, 10000).AsSequential() | |
where blah % 2 == 1 | |
select blah; | |
//By default the result of this custom list comprehension is an object called DelayedSequential<T>. | |
//This object is evaluated and a concrete collection is returned via an implicit conversion. | |
Sequential<int> s = x; | |
//Alternatively, we can write | |
Sequential<int> y = | |
from blah in Enumerable.Range(0, 1000).AsSequential() | |
select blah; | |
//In which case the conversion occurs right after the query is completed. | |
//More complex stuff: | |
var z = | |
from blah in Enumerable.Range(0, 100).AsSequential() | |
from blah2 in Enumerable.Range(0, blah) | |
select blah2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment