/***************************************************/ /**** Private Methods ****/ /***************************************************/ private static IBHoMObject _ShallowClone(this IBHoMObject bhomObject, bool newGuid = false) { IBHoMObject clone = DeepClonerExtensions.ShallowClone(bhomObject); if (bhomObject.CustomData != null) { clone.CustomData = new Dictionary <string, object>(bhomObject.CustomData); } else { clone.CustomData = new Dictionary <string, object>(); } if (bhomObject.Tags != null) { clone.Tags = new HashSet <string>(bhomObject.Tags); } else { clone.Tags = new HashSet <string>(); } if (newGuid) { clone.BHoM_Guid = Guid.NewGuid(); } return(clone); }
private bool jaExisteSequencia(string conexaoAtual, List <List <string> > rotas, List <string> caminhoAtual) { if (rotas.Count == 0 || caminhoAtual.Count == 0) { return(false); } List <string> newList = caminhoAtual; newList.Add(conexaoAtual); foreach (List <string> path in rotas) { List <string> listCompare = new List <string>(); listCompare = DeepClonerExtensions.DeepClone(path); listCompare.Add(conexaoAtual); if (listCompare.SequenceEqual(newList)) { return(true); } //foreach (string str in path) //{ // if (!str.Equals(conexaoAtual)) // return false; //} } return(false); }
public void ProfileCloning() { #if NET46 var root = BenchmarkObjectNonISerializablerDictionary.GetNewInitialized(); DesertOctopus.ObjectCloner.Clone(root); var c = Clone.ObjectGraph(root); var d = DeepClonerExtensions.DeepClone(root); Stopwatch sw = Stopwatch.StartNew(); for (int i = 0; i < 100000; i++) { DesertOctopus.ObjectCloner.Clone(root); } sw.Stop(); _output.WriteLine(sw.Elapsed.ToString()); #endif }
public static T DeepClone <T>(this T obj) { return(DeepClonerExtensions.DeepClone(obj)); }
/***************************************************/ private static object _ShallowClone(this object obj) { return(DeepClonerExtensions.ShallowClone(obj)); }
public Invoice DeepClone() => DeepClonerExtensions.DeepClone(this);