using System.Dynamic;
...
public partial class Form1 : Form
{
...
private void button1_Click(object sender, EventArgs e)
{
dynamic CBT = new CustomBindingTest();
CBT.DynamicMethodExample();
}
}
public class CustomBindingTest : DynamicObject
{
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
MessageBox.Show(binder.Name);
try { return base.TryInvokeMember(binder, args, out result); }
catch (RuntimeBinderException e) { result = null; return false; }
}
}
我得到以下錯誤:The type or namespace name 'RuntimeBinderException' could not be found (are you missing a using directive or an assembly reference?)
Visual Studio如何識別RuntimeBinderException?
這是VS快遞(2012年)的限制,還是我做錯了什麼?
'使用Microsoft.CSharp.RuntimeBinder;'? – 2013-03-28 06:53:00