实现非二叉树及其相关操作的最佳.NET库(商业或开源)是什么?要求是动态插入和删除节点,复制/粘贴节点,查找埋入节点中的信息,将文件夹及其子项从树的一个区域复制/粘贴到另一个区域。树在业务逻辑层。表示层是WPF。实现语言是C#。树的最佳.NET库
2
A
回答
2
树很容易编写,具体要求也相对多样化,我不确定“树库”会非常有用。你为什么不写自己的?
3
你可能想看看codeplex上的QuickGraph。
4
毫无疑问,我会说LINQ to XML。
XDocument doc = new XDocument(
new XDeclaration("1.0", "utf-8", "true"),
new XComment("Comment"),
new XElement("Employees",
new XElement("RootElement",
new XElement("Employee",
new XAttribute("id", "123"),
new XElement("name", "John"),
new XCData("CData")))));
// Selection multiple nodes
var allEmployees = xdoc.Root.Elements("Employees");
// Select single node
var employeeJohn = from node in xdoc.Root.Descendants().Elements("Employees").Elements("Employee")
where node.Attribute("id").Value == "123"
select node;
// Insert node
XElement newNode = new XElement("NewNode", "Node content");
allEmployees.Add(newNode);
// Delete node
employeeJohn.Remove();
+0
您应该添加一个如何在某些现有树上动态插入和移除节点的示例。 – 2009-09-03 10:09:06
4
我会用:
class MyTreeNode : List<MyTreeNode>
{
// declare per-node properties here, e.g.
public string Name { get; set; }
}
建筑及重新排列树是非常简单的:
MyTreeNode root = new MyTreeNode {Name = "root"};
MyTreeNode firstChild = new MyTreeNode {Name = "1"};
root.Add(firstChild);
MyTreeNode secondChild = new MyTreeNode { Name = "2" };
root.Add(secondChild);
root.Remove(firstChild);
secondChild.Add(firstChild);
相关问题
- 1. .NET的最佳JSON库?
- 2. 什么是.Net的最佳EXIF库?
- 3. .NET/Mono的最佳图形库
- 4. 多目标.NET库的最佳实践
- 5. php/Mysql最佳树结构
- 6. 从git仓库中提取树的最佳方式是什么?
- 7. 实现图树的最佳数据库结构
- 8. 二叉树的最佳填充顺序
- 9. jquery生成树的最佳控件
- 10. .NET List最佳方法
- 11. .net诊断最佳实践?
- 12. 创建使用.NET命名空间的库的最佳做法
- 13. 学习.NET/OOP最佳实践的最佳方法?
- 14. 最佳免费常微分方程库中的.NET
- 15. 在g ++中调用c#.net webservices的最佳库是什么?
- 16. .NET - 检查和控制Windows服务的最佳库是什么?
- 17. 什么是OpenID和ASP.NET MVC的最佳.NET库?
- 18. .NET写入Word的最佳库和插件
- 19. 安全的数据库连接。 DAL .net架构最佳实践
- 20. 提交到数据库后.net表单的最佳实践
- 21. 使用C#.Net访问SQL Server数据库的最佳方法
- 22. 在.NET中管理依赖关系树的最佳方式是什么?
- 23. Sharepoint的最佳ajax库
- 24. Maven库的最佳实践
- 25. OpenID的最佳Coldfusion库
- 26. 最佳压缩霍夫曼树
- 27. 学习.NET泛型的最佳资源?
- 28. .net的最佳微控制器?
- 29. 利用.NET 3.5的最佳方法
- 30. .Net WCF NAT穿越的最佳实践
而你所说的 '最佳' 是什么意思?最快的寻找时间?最小的内存占用?容易查询? – Pondidum 2009-09-02 10:57:24
速度快,学习曲线稳定。 – 2009-09-02 11:49:47
还有一件事:树将从XML或SQLSERVER填充 – 2009-09-02 11:51:18