Optional parameters in managed C++/CLI methods

后端 未结 3 1310
感情败类
感情败类 2020-12-10 23:58

How can I declare a managed method in C++/CLI that has an optional parameter when used from C#?

I\'ve decorated the parameter with both an Optional and a DefaultPara

3条回答
  •  鱼传尺愫
    2020-12-11 00:32

    As a workaround, you can just overload the constructor, and use delegation. It will be inlined by the JIT and should end up with the same final result as a default parameter value.

提交回复
热议问题