Beispiel #1
0
    public override void InitializeLoading(Log log)
    {
        if (_elementType != null)
        {
            _listTypeRepo = Serializer.GetOrCreateRepo(log, _elementType);
        }

        _propertyInfoCapacity = LoadableType.GetProperty("Capacity");
    }
Beispiel #2
0
    public override void SaveObject(BinaryWriter writer, object obj)
    {
        PropertyInfo countProp   = LoadableType.GetProperty("Count");       // IEnumerable isn't required to implement this
        IEnumerable  iEnumerable = (IEnumerable)obj;

        int count = (int)countProp.GetValue(iEnumerable, null);

        writer.Write(count);
        foreach (object item in iEnumerable)
        {
            Serializer.WriteObjectRef(_elementType, item, writer);
        }
    }