I call C# functions from PowerShell this way:
// C# code
public void Foo(string param1, int param2, Dictionary<string, string> param3)
# PowerShell code:
Add-Type -Path $pathToDll
$myClass= New-Object -TypeName MyClass
$dic= New-Object 'System.Collections.Generic.Dictionary[String,String]'
$dic.Add("Key1","Val1")
$dic.Add("Key2","Val2")
$myClass.Foo("Test1", 1, $dic)
But what if I want to call function with signature that has params in it:
public void Foo(string param1, int param2, params string[] param3)
How to call this function from powershell?
If I call it like this:
$myClass.Foo("Test1", 1, "foo1", "foo2", "foo3")
It shows an error: Cannot find an overload for "Foo" and the argument count: "5".