Accessing properties of anonymous/dynamic types across dll boundaries gives RuntimeBinderException

前端 未结 1 1078
既然无缘
既然无缘 2020-12-21 14:01

In the following sample, x.propertyX works fine, whereas y.propertyX gives me a Microsoft.CSharp.RuntimeBinder.RuntimeBinderException, com

相关标签:
1条回答
  • 2020-12-21 14:54

    Anonymous types are internal to the assembly they are created in. If you have control over the source code you can make them Friend Assemblies

    [assembly:InternalsVisibleTo("TheOtherAssembly")]
    

    but there are drawbacks.

    0 讨论(0)
提交回复
热议问题