如何在IDL中实现此属性:

    public int[] Params
    {
        get
        {
            return _Params;
        }
        set
        {
            _Params = value;
        }
    }

我尝试了下面的idl代码

[propget, helpstring("The click through parameters")] 
    HRESULT Params([out, retval] int *rVal);
[propput, helpstring("The click through parameters")] 
    HRESULT Params([in] int *RnewVal);

但是我的编译器正在寻找这个

public int get_Params()
{
    throw new NotImplementedException();
}

public void set_Params(ref int rVal)
{
    throw new NotImplementedException();
}

我99.999%肯定这是类型的问题。

有帮助吗?

解决方案

COM typelib导入程序更喜欢处理符合自动化的接口,因此请使用 SAFEARRAY

[propget, helpstring("The click through parameters")] 
HRESULT Params([out, retval] SAFEARRAY(long) *rVal);

[propput, helpstring("The click through parameters")] 
HRESULT Params([in] SAFEARRAY(long) RnewVal);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top