示例#1
0
        internal void Serialize(BinaryWriter writer)
        {
            IDictionaryEnumerator  e;
            HttpStaticObjectsEntry entry;
            bool hasInstance;

            writer.Write(Count);

            e = _objects.GetEnumerator();
            while (e.MoveNext())
            {
                entry = (HttpStaticObjectsEntry)e.Value;
                writer.Write(entry.Name);
                hasInstance = entry.HasInstance;
                writer.Write(hasInstance);

                if (hasInstance)
                {
                    AltSerialization.WriteValueToStream(entry.Instance, writer);
                }
                else
                {
                    writer.Write(entry.ObjectType.FullName);
                    writer.Write(entry.LateBound);
                }
            }
        }
示例#2
0
        internal void Serialize(BinaryWriter writer)
        {
            int    count;
            int    i;
            String key;
            Object value;

            count = Count;
            writer.Write(count);

            if (BaseGet(null) != null)
            {
                // We have a value with a null key.  Find its index.
                for (i = 0; i < count; i++)
                {
                    key = BaseGetKey(i);
                    if (key == null)
                    {
                        writer.Write(i);
                        break;
                    }
                }

                Debug.Assert(i != count);
            }
            else
            {
                writer.Write(NO_NULL_KEY);
            }

            for (i = 0; i < count; i++)
            {
                key = BaseGetKey(i);
                if (key != null)
                {
                    writer.Write(key);
                }
                value = BaseGet(i);
                AltSerialization.WriteValueToStream(value, writer);
            }
        }
示例#3
0
        public void Serialize(BinaryWriter writer)
        {
            writer.Write(this.Count);
            IDictionaryEnumerator enumerator = this._objects.GetEnumerator();

            while (enumerator.MoveNext())
            {
                HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)enumerator.Value;
                writer.Write(entry.Name);
                bool hasInstance = entry.HasInstance;
                writer.Write(hasInstance);
                if (hasInstance)
                {
                    AltSerialization.WriteValueToStream(entry.Instance, writer);
                }
                else
                {
                    writer.Write(entry.ObjectType.FullName);
                    writer.Write(entry.LateBound);
                }
            }
        }
 private void WriteValueToStreamWithAssert(object value, BinaryWriter writer)
 {
     AltSerialization.WriteValueToStream(value, writer);
 }