Does C# .NET support IDispatch late binding?

后端 未结 6 1171
情话喂你
情话喂你 2020-12-08 20:11

The Question

My question is: Does C# nativly support late-binding IDispatch?


Pretend i\'m trying to automate Office,

6条回答
  •  Happy的楠姐
    2020-12-08 20:55

    You gotta wait for C# 4.0 to come out to get the late binding that you are looking for. Any time I need interop capabilities I switch back to VB.Net mode so I can take advantage of the COM capabilities that C# seems to lack.

    The simple method that I use is creating a class in VB.Net that does the IDispatch work and then exposing the methods that I want to use as methods of my wrapper and then I can call them at will from my C# code. Not the most elegant of solutions, but it has gotten me out of a jam or two over the past few months.

提交回复
热议问题