Another gem today, when attempting to add a subclass collection to a base type list using the AddRange() method you may encounter the following error using this code: List<BaseClassA> baseList = new List<BaseClassA>(); baseList.AddRange((IEnumerable<SubClassB>) subList); // Where ‘SubClassB’ is a class deriving from ‘BaseClassA’ System.InvalidCastException was unhandled: Message=”Unable to cast object of type ‘System.Collections.Generic.List`1[MyNamespace.BaseClassA]‘ to [...]
Pages
Blogroll
-
RSS Links
My Tweets
- GONeale earned the Suspicious badge for Visual Studio Achievements: http://t.co/apqgBwgt via @ch9 #VSAchievements 2 weeks ago
- Seriously?! I never thought I would see this, but I guess I'm going to have to install.. :p http://t.co/bu93W9kN #VisualStudio #Achievements 2 weeks ago
- Calling all Aussies, have you checked out my new start-up? http://www.stayoftheday.com Would REALLY appreciate the support, share and earn credit! 2 weeks ago
- It's been a long time coming! I'm proud to announce my startup @StayOfTheDay pre-launch! Check it out, $500k giveaway http://t.co/nmh4rFp4 3 weeks ago
- Woohoo! I just got my slice of the @StayOfTheDay $500K giveaway, no more full price accommodation for me! Got yours? http://t.co/nmh4rFp4 3 weeks ago
- Wow! Database Schema and Data Compare has been in Visual Studio since 2008?? I never got THAT memo! http://t.co/TcWNZ3Tt #VisualStudio #.NET 2011-12-22
- More updates...
Advertisment