Created
September 5, 2012 01:11
-
-
Save masaru-b-cl/3628787 to your computer and use it in GitHub Desktop.
dynamicでobject型引数と闘う
This file contains hidden or 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; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
SomeMethod(new { Name = "Taro" }); | |
} | |
static void SomeMethod(object arg) | |
{ | |
dynamic a = arg; | |
string name = a.Name; | |
Console.WriteLine(name); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment