我有这个代码
function get-data()
{
$rec=[PSCustomObject]@()
$DLGP = "" | Select "Name","Grade","Score"
foreach($record in $data)
{
$DLGP.Name=$record.name
$DLGP.Grade=$record.grade
$DLGP.Score=$record.score
$rec += $DLGP
}
return $rec
}
$mydata=get-data
$mydata | Export-Csv -Path $outputPath -NoTypeInformation
问题是,数据没有按照我添加到 $rec 的顺序导出
如何按添加顺序导出它?