Created
March 1, 2015 05:58
-
-
Save yuntan/c76aa109d02cc8bd6806 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
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