public static CctvNode ToShallowClone(CctvNode cctvNode) { return(new CctvNode() { ID = cctvNode.ID, Type = cctvNode.Type, Name = cctvNode.Name }); }
private static CctvNode cctvNodeDeepClone(CCTVHierarchyNode cctvNode) { CctvNode node = ShallowClone(cctvNode); if (cctvNode.Children.Length > 0) { node.Children = new CctvNode[cctvNode.Children.Length]; for (int i = 0; i < cctvNode.Children.Length; i++) { node.Children[i] = cctvNodeDeepClone(cctvNode.Children[i]); } } return(node); }
public static CctvNode ToDeepClone(CctvNode cctvNode) { CctvNode node = ToShallowClone(cctvNode); if (cctvNode.Children.Length > 0) { node.Children = new CctvNode[cctvNode.Children.Length]; for (int i = 0; i < cctvNode.Children.Length; i++) { node.Children[i] = ToDeepClone(cctvNode.Children[i]); } } return(node); }
public static CctvNode DeepClone(CCTVHierarchyNode hNode) { try { if (hNode == null) { return(null); } CctvNode node = cctvNodeDeepClone(hNode); return(node); } catch { return(null); } }