I am trying to declare List in PowerShell, where the Person is defined using Add-Type:
add-type -Language CSharpVersion3 -TypeDefinition @"
public class Person
{
public Person() {}
public string First { get; set; }
public string Last { get; set; }
}
"@
This works fine:
New-Object Person
New-Object System.Collections.Generic.List``1[System.Object]
But this line fails:
New-Object System.Collections.Generic.List``1[Person]
What is wrong here?