internal static GraphStack New(GraphPointer model) { var stack = GenericPool <GraphStack> .New(() => new GraphStack()); stack.CopyFrom(model); return(stack); }
internal static GraphStack New(IGraphRoot root, List <IGraphParentElement> parentElements) { var stack = GenericPool <GraphStack> .New(() => new GraphStack()); stack.InitializeNoAlloc(root, parentElements, true); return(stack); }
public static CloningContext New(ICloner fallbackCloner, bool tryPreserveInstances) { var context = GenericPool <CloningContext> .New(() => new CloningContext()); context.fallbackCloner = fallbackCloner; context.tryPreserveInstances = tryPreserveInstances; return(context); }
public void Dispose() { if (disposed) { throw new ObjectDisposedException(ToString()); } GenericPool <CloningContext> .Free(this); }
public static Recursion <T> New(int maxDepth) { if (!Recursion.safeMode) { return(null); } if (maxDepth < 1) { throw new ArgumentException("Max recursion depth must be at least one.", nameof(maxDepth)); } var recursion = GenericPool <Recursion <T> > .New(() => new Recursion <T>()); recursion.maxDepth = maxDepth; return(recursion); }
protected virtual void Free() { GenericPool <Recursion <T> > .Free(this); }
public void Dispose() { GenericPool <GraphStack> .Free(this); }