c#加了一个新的关键字,以前大致知道,对于.net对象,其是用反省,对是com对象,其是用IDispatch.
今天才知道,它还有这样的用法
class Program
{
static void Main()
{
dynamic dynEO = new ExpandoObject();
dynEO.number = 20;
dynEO.MeThod = new Func<int, string>((int i) => { return (i+20).ToString(); });
Console.WriteLine(dynEO.number);
Console.WriteLine(dynEO.MeThod(dynEO.number));
Console.ReadKey();
}
}