Why does Get-Date seem to return DateTime objects, but the BinarySerializer indicate it returns a PSObject?

后端 未结 2 1119
误落风尘
误落风尘 2021-01-19 02:47

Take the simple HashTable:

$data = @{
    First = \'Justin\';
    Last = \'Dearing\';
    StartDate = Get-Date \'2002-03-23\';
}

The key St

2条回答
  •  [愿得一人]
    2021-01-19 03:45

    Base on the msdn:

    PSOobject Class : Encapsulates a base object of type Object or type PSCustomObject to allow for a consistent view of any object within the Windows PowerShell environment.

     ( get-Date '2002-03-23' ) -IS [psobject]
    True
    
    ( get-Date '2002-03-23' ) -IS [datetime]
    True
    
    [datetime]( get-Date '2002-03-23' ) -IS [datetime]
    True
    
    [datetime]( get-Date '2002-03-23' ) -IS [psobject]
    False
    

提交回复
热议问题