private void PrintRecursive(TreeNode treeNode)
{
// Print the node.
System.Diagnostics.Debug.WriteLine(treeNode.Text);
MessageBox.Show(treeNode.Text);
// Print each node recursively.
foreach (TreeNode tn in treeNode.Nodes)
{
PrintRecursive(tn);
}
}// Call the procedure using the TreeView.
private void CallRecursive(TreeView treeView)
{
// Print each node recursively.
TreeNodeCollection nodes = treeView.Nodes;
foreach (TreeNode n in nodes)
{
PrintRecursive(n);
}
}怎么转为数组 我想序列化用socket发送出去.
{
// Print the node.
System.Diagnostics.Debug.WriteLine(treeNode.Text);
MessageBox.Show(treeNode.Text);
// Print each node recursively.
foreach (TreeNode tn in treeNode.Nodes)
{
PrintRecursive(tn);
}
}// Call the procedure using the TreeView.
private void CallRecursive(TreeView treeView)
{
// Print each node recursively.
TreeNodeCollection nodes = treeView.Nodes;
foreach (TreeNode n in nodes)
{
PrintRecursive(n);
}
}怎么转为数组 我想序列化用socket发送出去.
可以考虑直接序列化xml然后发送这个xml
这样在接受端也可以很方便的在恢复成树状结构
可以看看下面这篇文章。
http://www.codeproject.com/csharp/TreeView_Serializer.asp该文章中的办法 不支持中文怎么办
ArrayList arrayList = new ArrayList();arrayList.Add(node);...........
Object[] personArrayFromList = (Object[])personList.ToArray(typeof(Object));