In general you shouldn't need to use List<T> directly in PS. Unless you're doing interop with a .NET type that requires it then just stick with PS arrays.
[System.Collections.Generic.List[Errors]] $errors = @()
# Or
$errors = New-Object System.Collections.Generic.List[Errors]
To add you need an Errors
object.
$item = New-Object -TypeName Errors
$item.X = 1
$item.Y = 2
$errors += $item
# Or...
$errors.Add($item)
Your first add won't work because the Errors
type doesn't have a constructor that accepts 2 parameters. The second add doesn't work because the Add function requires an Errors
.