static internal HttpStaticObjectsCollection Deserialize(BinaryReader reader) { int count; string name; string typename; bool hasInstance; Object instance; HttpStaticObjectsEntry entry; HttpStaticObjectsCollection col; col = new HttpStaticObjectsCollection(); count = reader.ReadInt32(); while (count-- > 0) { name = reader.ReadString(); hasInstance = reader.ReadBoolean(); if (hasInstance) { instance = AltSerialization.ReadValueFromStream(reader); entry = new HttpStaticObjectsEntry(name, instance, 0); } else { typename = reader.ReadString(); bool lateBound = reader.ReadBoolean(); entry = new HttpStaticObjectsEntry(name, Type.GetType(typename), lateBound); } col._objects.Add(name, entry); } return(col); }
// // Implementation of standard collection stuff // /// <include file='doc\httpstaticobjectscollection.uex' path='docs/doc[@for="HttpStaticObjectsCollection.this"]/*' /> /// <devdoc> /// <para>Gets the object in the collection with the given name (case /// insensitive). </para> /// </devdoc> public Object this[String name] { get { HttpStaticObjectsEntry e = (HttpStaticObjectsEntry)_objects[name]; return((e != null) ? e.Instance : null); } }
internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection(); IDictionaryEnumerator enumerator = this._objects.GetEnumerator(); while (enumerator.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)enumerator.Value; objectss.Add(entry.Name, entry.ObjectType, entry.LateBound); } return(objectss); }
public object this[string name] { get { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)this._objects[name]; if (entry == null) { return(null); } return(entry.Instance); } }
/* * Create a copy without copying instances (names and types only) */ internal HttpStaticObjectsCollection Clone() { HttpStaticObjectsCollection c = new HttpStaticObjectsCollection(); IDictionaryEnumerator e = _objects.GetEnumerator(); while (e.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)e.Value; c.Add(entry.Name, entry.ObjectType, entry.LateBound); } return(c); }
internal int GetInstanceCount() { int num = 0; IDictionaryEnumerator enumerator = this._objects.GetEnumerator(); while (enumerator.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)enumerator.Value; if (entry.HasInstance) { num++; } } return(num); }
/* * Get number of real instances created */ internal int GetInstanceCount() { int count = 0; IDictionaryEnumerator e = _objects.GetEnumerator(); while (e.MoveNext()) { HttpStaticObjectsEntry entry = (HttpStaticObjectsEntry)e.Value; if (entry.HasInstance) { count++; } } return(count); }
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); } } }
public static HttpStaticObjectsCollection Deserialize(BinaryReader reader) { HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection(); int num = reader.ReadInt32(); while (num-- > 0) { HttpStaticObjectsEntry entry; string name = reader.ReadString(); if (reader.ReadBoolean()) { object instance = AltSerialization.ReadValueFromStream(reader); entry = new HttpStaticObjectsEntry(name, instance, 0); } else { string typeName = reader.ReadString(); bool lateBound = reader.ReadBoolean(); entry = new HttpStaticObjectsEntry(name, Type.GetType(typeName), lateBound); } objectss._objects.Add(name, entry); } return objectss; }
public static HttpStaticObjectsCollection Deserialize(BinaryReader reader) { HttpStaticObjectsCollection objectss = new HttpStaticObjectsCollection(); int num = reader.ReadInt32(); while (num-- > 0) { HttpStaticObjectsEntry entry; string name = reader.ReadString(); if (reader.ReadBoolean()) { object instance = AltSerialization.ReadValueFromStream(reader); entry = new HttpStaticObjectsEntry(name, instance, 0); } else { string typeName = reader.ReadString(); bool lateBound = reader.ReadBoolean(); entry = new HttpStaticObjectsEntry(name, Type.GetType(typeName), lateBound); } objectss._objects.Add(name, entry); } return(objectss); }
static public HttpStaticObjectsCollection Deserialize(BinaryReader reader) { int count; string name; string typename; bool hasInstance; Object instance; HttpStaticObjectsEntry entry; HttpStaticObjectsCollection col; col = new HttpStaticObjectsCollection(); count = reader.ReadInt32(); while (count-- > 0) { name = reader.ReadString(); hasInstance = reader.ReadBoolean(); if (hasInstance) { instance = AltSerialization.ReadValueFromStream(reader); entry = new HttpStaticObjectsEntry(name, instance, 0); } else { typename = reader.ReadString(); bool lateBound = reader.ReadBoolean(); entry = new HttpStaticObjectsEntry(name, Type.GetType(typename), lateBound); } col._objects.Add(name, entry); } return col; }