Currently you can easily invoke regular methods through MethodInfo
$obj.SomeMethod.Invoke($arg1, $arg2)
Probably it's not a particularly useful for the end users, but this approach might be extremely useful in case if you deal with generic methods. Would it be hard to implement something like:
$obj.SomeMethod.InvokeGeneric([SomeType], $arg1, $arg2))
It's a PITA to deal with generics at this point. There is some issues opened a while ago, and it looks like it's too much work to bring generics same way as it's implemented in C#. The above interface might be simple/straight forward to use and implement(hopefully).
This would _most likely_ be a change in .NET Core itself rather than PowerShell, I would think? I _guess_ we could handle it with PSMethodInfo? 馃
If we're going to do something like this, we may as well just implement proper generic method handling, despite that probably being a little more complex to do properly.
Please see the already green-lit #5146
Thinking on this further... I have two thoughts.
Type[] rather than just Type for those ones.@mikeTWC1984 and @vexx32, I see you were both part of the original discussion in #5146, which is awaiting implementation - of basically the syntax proposed here - by someone from the community. @vexx32, it even includes your multiple-types suggestions: https://github.com/PowerShell/PowerShell/issues/5146#issuecomment-339010927
Unless I'm missing something: isn't this issue a duplicate?
That's a good point. I'd missed that this suggestion was already mentioned in the other issue.
I'll close this as duplicate for now. @mikeTWC1984 if you have more to add to the discussion in #5146, please feel free to add to that issue. 馃檪