Skip to content

Instantly share code, notes, and snippets.

@yuntan
Created March 1, 2015 05:58
Show Gist options
  • Save yuntan/c76aa109d02cc8bd6806 to your computer and use it in GitHub Desktop.
Save yuntan/c76aa109d02cc8bd6806 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello{
public static void Main(){
// Here your code !
var t = new {a = 0f, b = 0f};
Func<float, object> hoge = (float x) => new {a = x+1, b = x-1};
Func<float, object> fuga = (float y) => new {a = y*2, b = y/2};
var poyo = new[]{3f, 4f};
var puyo = new[]{5f, 6f, 7f};
foreach (var item in poyo.Select(hoge)) {
Console.WriteLine(Cast(item, new {a = 0f, b = 0f}).a);
}
foreach (var item in puyo.Select(fuga)) {
Console.WriteLine(Cast(item, new {a = 0f, b = 0f}).b);
}
}
private static T Cast<T>(object obj, T type)
{
return (T)obj;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment