You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add documentation for invoking generic methods with explicit type parameters #8533
Now that PowerShell/PowerShell#12412 was merged, we need to look at adding documentation around the syntax and some general use cases for calling generic methods where PowerShell can't infer the appropriate generic overload based on the argument types.
General syntax is:
# static generic methods
[type_name]::MethodName[generic_type_arguments](method_arguments)
# instance generic methods
$object.MethodName[generic_type_arguments](method_arguments)
# generic_type_arguments can be a a single type, or comma-separated list of types, like `[string, int]`,
# including other generic types like `$obj.MethodName[string, System.Collections.Generic.Dictionary[string, int]]()`
I would expect some of the most common use cases for this would be in using heavily generic types like System.Collections.Concurrent.ConcurrentDictionary and static methods with generic arguments like those found in the System.Linq namespace.
Note that as illustrated in this comment that certain methods may still require type casting their arguments appropriately at the moment.
Activity
Fixes #8533 - Add doc for using generic methods (#8554)