$instance.MyMethod($arg1,$arg2);...which can be confusing if you want to pass an array as a single argument:
$instance.MyMethod($myArray);Instead, force the array-argument to be contained within a single-member array:
New-Object : Cannot find an overload for "MyMethod" and the argument count: ""
# Note the extra comma belowMakes sense when you think about it, but definitely a gotcha.
$instance.MyMethod(,$myArray);
[In my case, I was caught out with the byte[] overload constructor for a MemoryStream]
1 comment:
Thanks for taking the time to write this up - this just caught me out constructing an IPAddress instance.
Post a Comment