Created
September 5, 2012 18:01
-
-
Save wilfrem/3641403 to your computer and use it in GitHub Desktop.
C# var sample?
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
using System; | |
using System.Collections.Generic; | |
class VarTest{ | |
public static void main(){ | |
int[] array = {1,2,3,4,5,6,7,8}; | |
//めんどくさい。 | |
IEnumerable<int> result1 = from it in array where it<5 select it; | |
Console.WriteLine(result1.ToString()); | |
//これでも分かる。理由: 右どうみてもLINQだろ。 | |
var result2 = from it in array where it<5 select it; | |
Console.WriteLine(result2.ToString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment