dspace-group/dscom

[Feature Request] Optional Parameters

Closed this issue · 2 comments

C# Optional Parameters seems to be not supported and instead the [Optional] attribute is used. Any chance to have them recognized?

Hi electro-logic,

do you have an example of what exactly does not work.
If I generate the following interface:

public interface IOptionalParameter
{
    public void Method1([Optional] string param1);
    public void Method2(int param1 = default);
    public void Method3(int param1 = 123);
}

The result is:

For Method1:

    - name: param1
      idlFlags: 17
      parameterFlags: PARAMFLAG_FIN, PARAMFLAG_FOPT
      typeDescription:
        type: VT_I4
      parameterDescription:
        parameterFlags: PARAMFLAG_FIN, PARAMFLAG_FOPT

For Method2:

    - name: param1
      idlFlags: 49
      parameterFlags: PARAMFLAG_FIN, PARAMFLAG_FOPT, PARAMFLAG_FHASDEFAULT
      typeDescription:
        type: VT_I4
      parameterDescription:
        parameterFlags: PARAMFLAG_FIN, PARAMFLAG_FOPT, PARAMFLAG_FHASDEFAULT
        defaultValue: 0

For Method3:

    - name: param1
      idlFlags: 49
      parameterFlags: PARAMFLAG_FIN, PARAMFLAG_FOPT, PARAMFLAG_FHASDEFAULT
      typeDescription:
        type: VT_I4
      parameterDescription:
        parameterFlags: PARAMFLAG_FIN, PARAMFLAG_FOPT, PARAMFLAG_FHASDEFAULT
        defaultValue: 123

At first glance, that looks right to me

Thanks for the reply, something was wrong on my side. Works fine.