Actually, we can do better.
For your single object example:
Function ConvertTo-FormatListView
{
Param (
$Data )
$Data.psobject.Properties | Select-Object -Property Name, Value
}
For multiple objects:
Function ConvertTo-FormatListView
{
Param (
$Data )
$Data.psobject.Properties | Select-Object -Property Name, Value
}
Function ConvertTo-FormatListView
{
[cmdletbinding()]
Param (
[parameter( ValueFromPipeline = $True )]
[object[]]
$Data )
Process
{
ForEach ( $Object in $Data )
{
$Object.psobject.Properties | Select-Object -Property Name, Value
}
}
}
(Slightly slower than the previous example, but not enough to measure, but less care about.)
Thanks,
Tim Curwick