Como você expressa um int [] propriedade em linguagem de descrição de interface?

StackOverflow https://stackoverflow.com/questions/1208654

  •  05-07-2019
  •  | 
  •  

Pergunta

Como você poderia implementar essa propriedade em IDL:

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

Eu tentei o código IDL abaixo

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

Mas o meu compilador está procurando este

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

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

Eu estou 99,999% de certeza que é um problema com os tipos.

Foi útil?

Solução

COM typelib importador prefere lidar com interfaces de automação compatíveis, por isso uso 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);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top