Skip to content

Instantly share code, notes, and snippets.

@wilfrem
Created September 5, 2012 18:01
Show Gist options
  • Save wilfrem/3641403 to your computer and use it in GitHub Desktop.
Save wilfrem/3641403 to your computer and use it in GitHub Desktop.
C# var sample?
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