我找到了我的问题的答案。我使用以下代码访问了“对象资源管理器层次结构”。
List<IExplorerHierarchy> hierarchyList = new List<IExplorerHierarchy>();
ObjectExplorerService objExplorerService = (ObjectExplorerService)ServiceCache.ServiceProvider.GetService(typeof(IObjectExplorerService));
System.Type t = objExplorerService.GetType();
PropertyInfo getHierarchyMethod = t.GetProperty("Tree", BindingFlags.Instance | BindingFlags.NonPublic);
var value = getHierarchyMethod.GetValue(objExplorerService, null);
PropertyInfo getHierarchyMethod2s = value.GetType().GetProperty("Hierarchies", BindingFlags.Instance | BindingFlags.NonPublic);
var value2 = getHierarchyMethod2s.GetValue(value, null);
foreach (var item in (Dictionary<string, IExplorerHierarchy>)value2)
{
hierarchyList.Add(item.Value);
}