Deserialize() public method

Deserialize from a stream.
public Deserialize ( Stream stream, int size ) : int
stream Stream A stream contains serialize.
size int Must be -1.
return int
        /// <summary>
        /// Deserialize from a stream.
        /// </summary>
        /// <param name="stream">A stream contains serialize.</param>
        /// <param name="size">Must be -1.</param>
        /// <returns>The number of bytes read from the stream.</returns>
        public override int Deserialize(Stream stream, int size)
        {
            int usedBytes = 0;

            AdapterHelper.Site.Assert.AreEqual(-1, size, "The size value MUST be -1, the actual value is {0}.", size);

            this.idsetList             = new List <REPLGUID_IDSETElement>();
            this.IsAllGLOBCNTInGLOBSET = true;
            this.IsAllGLOBCNTRanged    = true;
            this.IsDisjointGLOBCNTMadeIntoSingleton = true;
            this.HasAllDuplicateGLOBCNTRemoved      = true;
            this.HasGLOBCNTGroupedIntoRanges        = true;
            while (stream.Position < stream.Length)
            {
                REPLGUID_IDSETElement ele = new REPLGUID_IDSETElement();
                usedBytes += ele.Deserialize(stream, -1);
                this.IsAllGLOBCNTInGLOBSET = IsAllGLOBCNTInGLOBSET &&
                                             ele.GLOBSET.IsAllGLOBCNTInGLOBSET;
                this.IsAllGLOBCNTRanged = IsAllGLOBCNTRanged &&
                                          ele.GLOBSET.IsAllGLOBCNTRanged;
                this.IsDisjointGLOBCNTMadeIntoSingleton = IsDisjointGLOBCNTMadeIntoSingleton &&
                                                          ele.GLOBSET.IsDisjointGLOBCNTMadeIntoSingleton;
                this.HasAllDuplicateGLOBCNTRemoved = HasAllDuplicateGLOBCNTRemoved &&
                                                     ele.GLOBSET.HasAllDuplicateGLOBCNTRemoved;
                this.HasGLOBCNTGroupedIntoRanges = HasGLOBCNTGroupedIntoRanges &&
                                                   ele.GLOBSET.HasGLOBCNTGroupedIntoRanges;
                this.idsetList.Add(ele);
            }

            return(usedBytes);
        }
        /// <summary>
        /// Deserialize from a stream.
        /// </summary>
        /// <param name="stream">A stream contains serialize.</param>
        /// <param name="size">Must be -1.</param>
        /// <returns>The number of bytes read from the stream.</returns>
        public override int Deserialize(Stream stream, int size)
        {
            int usedBytes = 0;
            AdapterHelper.Site.Assert.AreEqual(-1, size, "The size value MUST be -1, the actual value is {0}.", size);

            this.idsetList = new List<REPLGUID_IDSETElement>();
            this.IsAllGLOBCNTInGLOBSET = true;
            this.IsAllGLOBCNTRanged = true;
            this.IsDisjointGLOBCNTMadeIntoSingleton = true;
            this.HasAllDuplicateGLOBCNTRemoved = true;
            this.HasGLOBCNTGroupedIntoRanges = true;
            while (stream.Position < stream.Length)
            {
                REPLGUID_IDSETElement ele = new REPLGUID_IDSETElement();
                usedBytes += ele.Deserialize(stream, -1);
                this.IsAllGLOBCNTInGLOBSET = IsAllGLOBCNTInGLOBSET
                    && ele.GLOBSET.IsAllGLOBCNTInGLOBSET;
                this.IsAllGLOBCNTRanged = IsAllGLOBCNTRanged
                    && ele.GLOBSET.IsAllGLOBCNTRanged;
                this.IsDisjointGLOBCNTMadeIntoSingleton = IsDisjointGLOBCNTMadeIntoSingleton
                    && ele.GLOBSET.IsDisjointGLOBCNTMadeIntoSingleton;
                this.HasAllDuplicateGLOBCNTRemoved = HasAllDuplicateGLOBCNTRemoved
                    && ele.GLOBSET.HasAllDuplicateGLOBCNTRemoved;
                this.HasGLOBCNTGroupedIntoRanges = HasGLOBCNTGroupedIntoRanges
                    && ele.GLOBSET.HasGLOBCNTGroupedIntoRanges;
                this.idsetList.Add(ele);
            }

            return usedBytes;
        }