2015-10-02 60 views
0

我不能使用get-member來顯示一個對象事件,而getevents()方法起作用。 爲什麼?什麼阻止get-member顯示事件?

PS>([System.Timers.Timer] |gm -MemberType event |measure).count 
0                 

PS>[System.Timers.Timer].getevents().count 
2         

PS>[System.Timers.Timer].getevents() |select name 

Name            
----            
Elapsed            
Disposed       

回答

0

好,我已經看到了我的錯誤

$t=New-Object -TypeName system.timers.timer 
PS>$t |gm -MemberType event |select name 

Name          
----          
Disposed         
Elapsed  

PS>$t.GetType().fullname 
System.Timers.Timer  

PS>[system.timers.timer].GetType().FullName 
System.RuntimeType