$mytest | add-member noteproperty Name "test1"
$mytest | add-member noteproperty Age 3
$mytest | add-member noteproperty Height 1.89
$mytest | add-member noteproperty Likes "play computer"
$mytest
显示:
Name Age Height Likes
---- --- ------ -----
test1 3 1.89 play computer
增加方法
$mytest | add-member scriptmethod method1 {"this is my method1"}
$mytest | add-member scriptmethod method2 {"this is my method2"}
$mytest | add-member scriptmethod method3 {"this is my method3"}
$mytest.method1()
显示:
this is my method1
$mytest.method2()
显示:
this is my method2
$mytest.method3()
显示:
this is my method3