call C# method from powershell without supplying optional arguments

后端 未结 2 491
余生分开走
余生分开走 2020-12-18 08:13

I have a c# method I am loading from a dll with optional string arguments that default to null. For example

public void foo(string path, string         


        
2条回答
  •  鱼传尺愫
    2020-12-18 08:47

    No can do in PowerShell. It doesn't support C#/VB optional parameters. It is the duty of the language calling the method to provide the default values when the programmer doesn't and PowerShell just doesn't do that.

提交回复
热议问题