关于 RuntimeBinderException 异常

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException的异常一般来自于两种:

第一种情况:

Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported

解决办法:直接在项目引用中添加 Micorsoft.Csharp 

 

第二种情况:

an exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException'

引起这种异常的错误是因为匿名类型不能跨程序集(assembly),

解决办法:在源程序集的AssemblyInfo.cs中加入

[assembly: InternalsVisibleTo("NameSpace1.SubNameSpace1")]

这样,匿名类型可以传递到目标程序集了。

 

posted @ 2017-06-20 18:15  wxlevel  阅读(1637)  评论(0编辑  收藏  举报