In PowerShell, if $dt
is a datatable, I am used to using foreach()
to do row-by-row operations. For example...
foreach ($tmpRow in $dt) {
Write-Host $tmpRow.blabla
}
I just want to get the first row (of n
columns). I could introduce a counter $i
and just break the foreach loop on the first iteration, but that seems clunky. Is there a more direct way of achieving this?