public void SaveTo(SaveEntryFolder parentFolder, IArchiveContext archiveContext)
        {
            int             entryCount = this._containerType == ContainerType.Dictionary ? this._elementCount * 2 : this._elementCount;
            SaveEntryFolder folder     = archiveContext.CreateFolder(parentFolder, new FolderId(this.ObjectId, SaveFolderExtension.Container), entryCount);

            for (int id = 0; id < this._elementCount; ++id)
            {
                ElementSaveData elementSaveData = this._values[id];
                BinaryWriter    binaryWriter1   = BinaryWriterFactory.GetBinaryWriter();
                BinaryWriter    binaryWriter2   = binaryWriter1;
                elementSaveData.SaveTo((IWriter)binaryWriter2);
                folder.CreateEntry(new EntryId(id, SaveEntryExtension.Value)).FillFrom(binaryWriter1);
                BinaryWriterFactory.ReleaseBinaryWriter(binaryWriter1);
                if (this._containerType == ContainerType.Dictionary)
                {
                    ElementSaveData key           = this._keys[id];
                    BinaryWriter    binaryWriter3 = BinaryWriterFactory.GetBinaryWriter();
                    BinaryWriter    binaryWriter4 = binaryWriter3;
                    key.SaveTo((IWriter)binaryWriter4);
                    folder.CreateEntry(new EntryId(id, SaveEntryExtension.Key)).FillFrom(binaryWriter3);
                    BinaryWriterFactory.ReleaseBinaryWriter(binaryWriter3);
                }
            }
            foreach (ObjectSaveData childStruct in this._childStructs)
            {
                childStruct.SaveTo(folder, archiveContext);
            }
        }
        public void SaveHeaderTo(SaveEntryFolder parentFolder, IArchiveContext archiveContext)
        {
            SaveEntryFolder folder       = archiveContext.CreateFolder(parentFolder, new FolderId(this.ObjectId, SaveFolderExtension.Container), 1);
            BinaryWriter    binaryWriter = BinaryWriterFactory.GetBinaryWriter();

            this._typeDefinition.SaveId.WriteTo((IWriter)binaryWriter);
            binaryWriter.WriteByte((byte)this._containerType);
            binaryWriter.WriteInt(this.GetElementCount());
            EntryId entryId = new EntryId(-1, SaveEntryExtension.Object);

            folder.CreateEntry(entryId).FillFrom(binaryWriter);
            BinaryWriterFactory.ReleaseBinaryWriter(binaryWriter);
        }