add-type -Language CSharpVersion3 -TypeDefinition @"
public class pack_code
{
public pack_code() {}
public string code { get; set; }
public string type { get; set; }
}
"@
$a = New-Object pack_code
$a.code = "3"
$a.type = "5"
$b = New-Object pack_code
$b.code = "2"
$b.type = "5"
$c = New-Object pack_code
$c.code = "2"
$c.type = "5"
$d = New-Object pack_code
$d.code = "1"
$d.type = "1"
$codes = New-Object 'System.Collections.Generic.List[object]'
$codes.add($a)
$codes.add($b)
$codes.add($c)
$codes.add($d)
is there a way to select distinct from $codes and select the objects where type equals 1? How can i use linq with PowerShell?