我有自己的类MyTreeNode
派生自TreeNode
:
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
字段。我怎样才能解决这个问题 ?