Link to home
Start Free TrialLog in
Avatar of Erwin Pombett
Erwin PombettFlag for Switzerland

asked on

how can i recover an object - looking up on a property - out of an array of custom objects ?

Hello,

how can i recover an object like we do in linq out of list of custom objects.



$collaborators = Import-Csv $PSScriptRoot/collaborateur.csv -Delimiter ';' 

$PeopleInObjects = @()

foreach($collabo in $collaborators)
{
    $pObject = New-Object  PSObject

    $pObject | Add-Member -MemberType NoteProperty "Matricule"       $collabo.Matr
    $pObject | Add-Member -MemberType NoteProperty "Firstname"       $collabo.Prenom
    $pObject | Add-Member -MemberType NoteProperty "LastName"        $collabo.Nom
   

    $PeopleInObjects += $pObject 
}

Open in new window



// here how can i recover one object after it's lastname ?

thank you in advance
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial