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
(Array.Empty was chosen as a simplest possible example. In scripts Iʼd use @())
Current behavior
At line:1 char:16
+ [Array]::Empty[string]()
+ ~
Array index expression is missing or not valid.
At line:1 char:16
+ [Array]::Empty[string]()
+ ~~~~~~~
Unexpected token 'string]' in expression or statement.
At line:1 char:24
+ [Array]::Empty[string]()
+ ~
An expression was expected after '('.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingArrayIndexExpression
Ruminations
I understand that itʼs not important to have full support of generics in a scripting language or to have 100% feature parity with C# (I might be wrong, — now we have classes in PowerShell after all 🤔)
Here are some not-very-elegant workarounds from the Interwebs:
Please provide ability to invoke generic methods with explicit type parameters.
Steps to demonstrate
or using a class:
(
Array.Emptywas chosen as a simplest possible example. In scripts Iʼd use@())Current behavior
Ruminations
I understand that itʼs not important to have full support of generics in a scripting language or to have 100% feature parity with C# (I might be wrong, — now we have
classesin PowerShell after all 🤔)Here are some not-very-elegant workarounds from the Interwebs:
Here are my questions:
Just posting this here for discussion. Didnʼt find any mentions of this problem in other issues.