foreach(DirectoryEntry domain in root.Children){ lb_pcName.Items.Add(""★★★""+domain.Name+""★★★""); foreach(DirectoryEntry pc in domain.Children) { if(pc.Name!=""Schema"")//Schema是结束标记 lb_pcName.Items.Add("" ""+pc.Name); }} 转载于:https://www.cnblogs.com/tingfeng/articles/488520.html