2
我有我自己的類MyTreeNode
從TreeNode
得出:如何覆蓋TreeNode.Clone()方法?
public class MyTreeNode : System.Windows.Forms.TreeNode
{
[Localizable(true)]
public bool Foo { get; set; }
}
我嘗試克隆節點:
MyTreeNode myTreeNode = new MyTreeNode();
myTreeNode.Foo = foo;
//
//And here is the problem, all fields have been copied to the new node but Foo
//
MyTreeNode newNode = (MyTreeNode)myTreeNode.Clone();
在結果,newNode
有空Foo
場。我怎樣才能解決這個問題 ?