Tech Off Post

Single Post Permalink

View Thread: Generic Base class problem
  • User profile image
    ploe

    cdwatkins said:

    Your talking about a contra/co- variance problem.  The problem is that IList<Bob> isnt assignable to IList<Person> even though Bob is a type of person.  They fixed this problem in .NET 4.

    Probably not the solution you are looking for, but you could do this:

     

    Have only one Customer class and make your 'special' members internal so only you can use them. If it's in a different assembly from where you need it you can use this to gain access to the internal members: http://msdn.microsoft.com/en-us/library/0tke9fxk.aspx