AutoMapper - from generic Collection to non-generic collection
===

I working within an older application (from 1.1 days) and there are many non-generic collections like:

    [Serializable]
    public class MyEntityList : CollectionBase
    {
        private int _virtualRecordCount;

        public int VirtualRecordCount
        {
            get { return _virtualRecordCount; }
            set { _virtualRecordCount = value; }
        }

        public MyEntityList()
        {
        }

        public MyEntityList(MyEntity[] arr)
        {
            AddRange(arr);
        }

        public MyEntityList this[int index]
        {
            get { return (MyEntity)InnerList[index]; }
        }

        public void Add(MyEntity item)
        {
            InnerList.Add(item);
        }

        etc...


I've upgraded a layer of the application to use a generic `Collection<T>` for the return type.  This layer is auto-generated and the class names are based upon the datasource table names. The business entity classes don't necessary line up either, but not so in this case.  In this case, they match perfectly 1:1.

I tried mapping the collections like so:

    Collection<MyEntityResponse> responses = GetMyEntityResponses();

    AutoMapper.Mapper.CreateMap<MyEntityResponse, MyEntity>();
    myEntityList = AutoMapper.Mapper.Map<MyEntityList>(responses);

The strangest thing... I thought that it might squawk at the use of `CollectionBase`, but I hit F5 anyway.  To my suprise, no compiler error and no exception.  WOOHOO!

However, later in the app it threw an exception complaining about a type conversion from `MyEntityResponse` to `MyEntity` when it tried to perform a `foreach()` on `MyEntityList` that was returned from Mapper.Map.

What happened is a new `MyEntityList` collection was returned but it was filled with `MyEntityResponse` objects.  Huh??  The custom collection overrides the `Add()` method and specifies that the type must be of type `MyEntity`.  I would expect it to blow up when attempting to add the wrong type to the collection, but it didn't seem to have any issues working with `CollectionBase`.

So my questions are, if the two types I'm trying to map match perfectly (property to property), and AutoMapper didn't have an issue with CollectionBase, why was it not able to map the enties?  And why didn't it throw an exception instead of shoving the wrong type into the collection?