We help IT Professionals succeed at work.

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

Erwin Pombett
on
94 Views
Last Modified: 2017-04-05
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
Comment
Watch Question

PowerShell Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION