The snippet below detects from a list of files which of them is a Directory on Ftp
as C# it will be like below
var files = new List(){\"App
as Robert Groves said, Select-Object -First Occurence do the tricks, you can also use -Last Occurence.
by the way, like any other static .Net method you can use linq in powershell.
[Linq.Enumerable]::First($list)
[Linq.Enumerable]::Distinct($list)
[Linq.Enumerable]::Where($list, [Func[int,bool]]{ param($item) $item -gt 1 })