public interface IMenuCollection<T> : ICollection<T>
public class HTMLMenuCollection: IMenuCollection<HTMLMenu>
This is my custom collection definition. I am trying to cast to it from another collection IList.
IList<HTMLMenu> htmlMenuList = new List<HTMLMenu>();
...
HTMLMenuCollection tempColl = (HTMLMenuCollection)htmlMenuList;
I have no idea why this won't work. If I cast IList to ICollection it works just fine, but with this I get an invalid cast exception.
Any help would be greatly appreciated.