public virtual void Activate(IReferenceActivationContext context) { ICollection collection = (ICollection)((UnmarshallingContext)context).PersistentObject (); ClearCollection(collection); ITypeHandler4 elementHandler = ReadElementTypeHandler(context, context); int elementCount = context.ReadInt(); for (int i = 0; i < elementCount; i++) { object element = context.ReadObject(elementHandler); AddToCollection(collection, element); } }
public virtual void Activate(IReferenceActivationContext context) { var collection = (ICollection)((UnmarshallingContext)context).PersistentObject (); ClearCollection(collection); var elementHandler = ReadElementTypeHandler(context, context); var elementCount = context.ReadInt(); for (var i = 0; i < elementCount; i++) { var element = context.ReadObject(elementHandler); AddToCollection(collection, element); } }
public virtual void Activate(IReferenceActivationContext context) { UnmarshallingContext unmarshallingContext = (UnmarshallingContext)context; IDictionary map = (IDictionary)unmarshallingContext.PersistentObject(); map.Clear(); KeyValueHandlerPair handlers = ReadKeyValueTypeHandlers(context, context); int elementCount = context.ReadInt(); for (int i = 0; i < elementCount; i++) { object key = unmarshallingContext.ReadFullyActivatedObjectForKeys(handlers._keyHandler ); if (key == null && !unmarshallingContext.LastReferenceReadWasReallyNull()) { continue; } object value = context.ReadObject(handlers._valueHandler); map[key] = value; } }