PSSharedGoods icon indicating copy to clipboard operation
PSSharedGoods copied to clipboard

ConvertTo-FlatObject, DataType to String

Open DonDom86 opened this issue 2 years ago • 3 comments

Why do you convert the datatypes all to string? Is it needed?

... Line 99 elseif ($Object.GetType().Name -in 'String', 'DateTime', 'TimeSpan', 'Version', 'Enum') { $Object = $Object.ToString() } elseif ($Depth) ...

Best Regards

DonDom86 avatar Mar 20 '23 14:03 DonDom86

Why not? It's for display purposes. If you don't convert Enum to string you will end up with numbers in your exports to HTML for example.

PrzemyslawKlys avatar Mar 20 '23 14:03 PrzemyslawKlys

I wanted to use the function for a different use case. Here I need the original data types ... Do you want to implement my enhancement? I think there is no problem with 'DateTime', 'TimeSpan'.

Best regards

DonDom86 avatar Mar 20 '23 14:03 DonDom86

You could implement a switch to not do conversion. Feel free

PrzemyslawKlys avatar Mar 20 '23 15:03 PrzemyslawKlys