I am trying to return List< T> from PowerShell function, but get one of:
- null - for empty list
- System.Int32 - for list with one element
- System.Object[] - for list with more elements
Code:
function CreateClrList
{
$list = New-Object "System.Collections.Generic.List``1[System.Int32]"
$list.Add(3)
$list
}
Write-Host (CreateClrList).GetType()