Last active
August 29, 2015 14:01
-
-
Save ViIvanov/64530a70d3aa6a0821a3 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
static class C | |
{ | |
static object M0<T>(IEnumerable<T> source) { | |
// linq с новой строки | |
var e1 = | |
from item in source | |
select item.ToString(); | |
return e1; | |
} | |
static object M1<T>(IEnumerable<T> source) { | |
// а для return исключение | |
return from item in source | |
select item.ToString(); | |
} | |
static object M2<T>(IEnumerable<T> source) { | |
var e1 = ( | |
from item in source | |
select item.ToString() | |
).ToList(); | |
var e2 = e1.Any() | |
? (from item in e1 | |
// A few-lines linq here… | |
select result).ToArray() | |
: new T[0]; | |
return e2; | |
} | |
static object M3<T>(IEnumerable<T> source) { | |
// Specific join with "on" on the same indent | |
return from item in source | |
join xxx in | |
from qqq in Enumerable.Range(1, 10) | |
select qqq.ToString() | |
on item.ToString() equals xxx.ToString() | |
select item.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment