{"id":3621,"date":"2014-03-29T07:02:37","date_gmt":"2014-03-29T07:02:37","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/problem-about-com-interface-collection-of-common-programming-errors\/"},"modified":"2014-03-29T07:02:37","modified_gmt":"2014-03-29T07:02:37","slug":"problem-about-com-interface-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/problem-about-com-interface-collection-of-common-programming-errors\/","title":{"rendered":"problem about com-interface-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0ec0f5be7749c8cc8ccda4a809103f36?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nsvick<br \/>\n.net com-interop com-interface<br \/>\nFollowing this article, I have successfully translated C++ COM class\/interface declaration into C# like this:[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid(IfaceGuid)] public interface IFoo {void Bar(); }[ComImport, Guid(ClassGuid)] public class Foo { }I use it like this:var foo = new Foo(); var ifoo = (IFoo)foo;ifoo.Bar();My question is, how can this possibly work, considering that Foo doesn&#8217;t implement IFoo (even at runtime, typeof(Foo).GetInterfaces() is empty) and that user-defin<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>svick .net com-interop com-interface Following this article, I have successfully translated C++ COM class\/interface declaration into C# like this:[InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid(IfaceGuid)] public interface IFoo {void Bar(); }[ComImport, Guid(ClassGuid)] public class Foo { }I use it like this:var foo = new Foo(); var ifoo = (IFoo)foo;ifoo.Bar();My question is, how can this possibly work, considering that Foo doesn&#8217;t [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3621","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3621"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3621\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}