/// <summary> /// Clone this node /// </summary> /// <returns></returns> public GridNode Clone(bool deep) { GridNode res = new GridNode { GeneralServiceLevel = this.GeneralServiceLevel, ReferencedElementId = this.ReferencedElementId, Name = this.Name, Id = this.Id, IsSiteOffline = this.IsSiteOffline, OfflineStartTime = this.OfflineStartTime, ElementType = this.ElementType }; if (deep) { foreach (GridNode child in SubNodes) { res.SubNodes.Add(child.Clone(deep)); } // foreach } return res; }
private static string GetTopologyString(GridNode node) { if (node.SubNodes.Count == 0) return node.Id.ToString(); else { StringBuilder sb = new StringBuilder(); sb.Append(node.Id.ToString()); for (int i = 0; i < node.SubNodes.Count; i++) { GridNode child = node.SubNodes[i]; sb.Append(GetTopologyString(child)); } // for return sb.ToString(); } // else }