2017-05-10 38 views
0

我正在寫一個小代碼來獲得一臺機器上的Windows更新。WUApiLib得到根類別名稱

我把一切都準備很好,下面的代碼:

ISearchResult sResult = uSearcher.Search("IsInstalled=0 AND IsHidden=0"); 

//Count updates needed 
int totalUpdates = sResult.Updates.Count; 

//Here im trying to get RootCategories name, but I don't know the correct type to use to get 
//that information. I can see the data I want on debugger, but I cannot figure out which type. 

foreach (var s in sResult.RootCategories) 
{ 

} 

這裏是展示一下我的意思是一張圖片:

https://i.stack.imgur.com/EIYI5.png

所以我怎麼分類的名字嗎?

回答

0

更新!

我得到了它,要知道COM包裝背後的實際類型,使用此:

Debug.Write(Microsoft.VisualBasic.Information.TypeName([YOUR COM OBJECT])); 

,將告訴你的對象類型,在我的情況:ICategory

我希望它能幫助別人其他!