/// <summary> /// Returns a deep copy of either a graph or a match or a class object or a transient class object or a container /// </summary> /// <param name="toBeCopied">The graph or match or (transient) class object or container to be copied</param> /// <returns>The copy</returns> public static object Copy(object toBeCopied, IGraph graph) { if (toBeCopied is IGraph) { return(GraphHelper.Copy((IGraph)toBeCopied)); } else if (toBeCopied is IMatch) { return(((IMatch)toBeCopied).Clone()); } else if (toBeCopied is IObject) { return(((IObject)toBeCopied).Copy(graph, new Dictionary <IBaseObject, IBaseObject>())); } else if (toBeCopied is ITransientObject) { return(((ITransientObject)toBeCopied).Copy(graph, new Dictionary <IBaseObject, IBaseObject>())); } else { return(ContainerHelper.Copy(toBeCopied, graph, new Dictionary <IBaseObject, IBaseObject>())); } }