Ejemplo n.º 1
0
        public override ILazinator CloneLazinator(IncludeChildrenMode includeChildrenMode = IncludeChildrenMode.IncludeAllChildren, CloneBufferOptions cloneBufferOptions = CloneBufferOptions.IndependentBuffers)
        {
            GenericFromBase <T> clone;

            if (cloneBufferOptions == CloneBufferOptions.NoBuffer)
            {
                clone = new GenericFromBase <T>(includeChildrenMode);
                clone.LazinatorObjectVersion = LazinatorObjectVersion;
                clone = (GenericFromBase <T>)AssignCloneProperties(clone, includeChildrenMode);
            }
            else
            {
                LazinatorMemory bytes = EncodeOrRecycleToNewBuffer(includeChildrenMode, OriginalIncludeChildrenMode, IsDirty, DescendantIsDirty, false, LazinatorMemoryStorage, this);
                clone = new GenericFromBase <T>(bytes);
            }
            return(clone);
        }
Ejemplo n.º 2
0
        protected override ILazinator AssignCloneProperties(ILazinator clone, IncludeChildrenMode includeChildrenMode)
        {
            base.AssignCloneProperties(clone, includeChildrenMode);
            GenericFromBase <T> typedClone = (GenericFromBase <T>)clone;

            typedClone.MyInt = MyInt;
            if (includeChildrenMode != IncludeChildrenMode.ExcludeAllChildren && includeChildrenMode != IncludeChildrenMode.IncludeOnlyIncludableChildren)
            {
                if (MyT == null)
                {
                    typedClone.MyT = default(T);
                }
                else
                {
                    typedClone.MyT = (T)MyT.CloneLazinator(includeChildrenMode, CloneBufferOptions.NoBuffer);
                }
            }

            return(typedClone);
        }