开发者

Does dynamic work with IUnknown and Typelib

Currently I'm experimenting with C#4's dynamic programming and I did not completely understand under which circumstances the keyword dynamic works. It is clear to me that it works with IDispatch, as it allows to inform the caller with type information automatically. But shouldn't it also work with IUnknown and a type lib? (In http://samgentile.com/Web/vs2010-and-net-framework-4-0/c-4-0-bcl-4-series-dynamic-primitive-type-part-1/ I found a vague hint that a Binding to IUnknown should be possible.)

  • IUnknown w/o typelib: should not work, the interfaces mus开发者_开发知识库t be written in C# explicitly, so I didn't try it. (Confirmed by Hans Passant in C# 4.0 dynamic object and WinAPI interfaces like IShellItem (without defining them in the C# source).)
  • IUnknown w/ type lib: I have completely no idea, if it works and how it works as I found no clear information. (I linked the type lib into the COM dll, but the DLR could not bind methods.)

So does IUnknown w/ type lib work with C#'s dynamic keyword? - If so, what do I have to do?


My current foundings are that the COM-binder only works with IDispatch and not with IUnknown at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜