COM->.NET - can't access overloaded method

后端 未结 2 1947
礼貌的吻别
礼貌的吻别 2021-01-25 15:00

I\'m trying to access a .Net library (The Image Resizer) from COM (jscript).

I\'ve tried both IDispatch and class interface generation, as well as [ClassInterface( Clas

2条回答
  •  爱一瞬间的悲伤
    2021-01-25 15:24

    Overloading does not work for the interop layer to COM. You could however use optional parameters and hide all other methods from the COM layer:

    // COM won't see this.
    [ComVisible(false)]
    void Test(string a) 
    
    // COM will see this and parameter b is not required
    void Test(string a, [DefaultParameterValue(null)] string b)  
    

提交回复
热议问题