在C ++ / CLI使用的动态C#对象

在C ++ / CLI使用的动态C#对象

问题描述:

我目前正在建立一个C ++ / CLI互操作库。该库将C#和vb.net应用程序使用,我想利用.NET 4的动态类型。我有一个使用动态成员访问参考配置键配置模块,这部作品在C#罚款,但给我的麻烦在C ++ / CLI(并非完全出乎意料)
有什么办法在C中使用这个库++ / CLI(例如,通过调用TryGetMember()直接或东西)?如果C ++ / CLI库,然后通过动态配置,在C#编写派生类中,将在C#中仍然能够使用动态成员访问?需要注意的是基类在C ++ / CLI定义,因此我将无法使用动态关键字。 (或者我会?)

I'm currently building a c++/cli interop library. The library will be consumed by c# and vb.net applications, and I would like to make use of .Net 4 dynamic typing. I have a configuration module that uses dynamic member access to refer to configuration keys, this works fine in c# but is giving me trouble in c++/cli (not entirely unexpected) Is there any way to use this library in C++/CLI (e.g. by invoking TryGetMember() directly or something)? If the C++/CLI library then passes the dynamic configuration to a derived class written in C#, will the C# still be able to use dynamic member access? Note that the base class is defined in c++/cli, so I wouldn't be able to use the dynamic keyword. (or would I?)

有是一个开源库,ImpromptuInterface(通过的NuGet中),简化了所使用的API的C#编译器在动态关键字参与,我认为它在C ++ / CLI,因为他们只是静态的C#功能。我知道它在还没有DLR支持F#。

There is an open source library, ImpromptuInterface (found via nuget) that simplifies the api's used by the c# compiler when the dynamic keyword is involved, I'd assume it works in c++/cli, since they are just static c# functions. I know it works in F# that also doesn't have DLR support.

下面是一个的调用它可以做动态列表