【问题标题】:How do you express a int[] property in interface description language?如何用接口描述语言表达一个 int[] 属性?
【发布时间】:2009-07-31 05:00:02
【问题描述】:

您将如何在 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% 确定这是类型的问题。

【问题讨论】:

  • 你在原始代码中拼错了Params。
  • 触动了我。固定的。然而,这个错误不在代码中

标签: c# com idl


【解决方案1】:

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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-08
    • 1970-01-01
    • 1970-01-01
    • 2017-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-04
    相关资源
    最近更新 更多