How can you test if an object has a specific property?

后端 未结 14 964
北恋
北恋 2020-12-25 09:01

How can you test if an object has a specific property?

Appreciate I can do ...

$members = Get-Member -InputObject $myobject 

and th

14条回答
  •  忘掉有多难
    2020-12-25 09:39

    For me MyProperty" -in $MyObject.PSobject.Properties.Name didn't work, however

    $MyObject.PSobject.Properties.Name.Contains("MyProperty")
    

    works

提交回复
热议问题