Created
March 22, 2013 15:23
-
-
Save masaru-b-cl/5222118 to your computer and use it in GitHub Desktop.
DynamicObjectのTry~でfalseを返すと・・・
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.Dynamic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace ConsoleApplication1 | |
| { | |
| class MyDynamic : DynamicObject | |
| { | |
| public override bool TryGetMember(GetMemberBinder binder, out object result) | |
| { | |
| result = binder.Name; | |
| return false; | |
| } | |
| } | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| dynamic clazz = new MyDynamic(); | |
| Console.WriteLine(clazz.hoge); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment