Comment exprimez-vous une propriété int [] dans le langage de description d'interface?
Question
Comment implémenteriez-vous cette propriété dans IDL:
public int[] Params
{
get
{
return _Params;
}
set
{
_Params = value;
}
}
J'ai essayé le code idl ci-dessous
[propget, helpstring("The click through parameters")]
HRESULT Params([out, retval] int *rVal);
[propput, helpstring("The click through parameters")]
HRESULT Params([in] int *RnewVal);
Mais mon compilateur cherche cela
public int get_Params()
{
throw new NotImplementedException();
}
public void set_Params(ref int rVal)
{
throw new NotImplementedException();
}
Je suis sûr à 99,999% que c'est un problème de types.
La solution
L'importateur COM de typelib préfère traiter avec des interfaces compatibles Automation, utilisez donc 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);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow