Covariance not working with generic dictionary entry?

Generic covariance has to be specified at the declaration of the covariant type - and it can only be specified for interfaces and delegates So, given that you're using a class, a ConcreteEmployeeRoleCreator.

Generic covariance has to be specified at the declaration of the covariant type - and it can only be specified for interfaces and delegates. So, given that you're using a class, a ConcreteEmployeeRoleCreator will never be a ConcreteEmployeeRoleCreator You'll need to look for an alternative approach. To be honest, by the time you get to three type parameters and want two of them to be covariant, you've got a pretty hard-to-understand design to start with, I'm afraid :(.

I am actually relieved you put it that way! I am trying to work thru a design on the "Role Object Pattern" by Baumer, Reihle in '97 where they use another pattern of theirs, "Product Trader" which had a c++ template that seemed to be equivalent of the generic class I came up with. I am hoping that if the paper were written today it would just use Activator.

CreateInstance(Type) like I am doing now. Cheers – Berryl Jul 10 at 20:34.

I would like to have a dictionary of 'creators', but I haven't been able to work out how to do it yet. Salesman is an EmployeeRole, and SalesmanRoleSpecification is an EmployeeRoleSpecification (or I wouldn't be able to define the creator above without a compiler error as well). SO I guess it is the way I am declaring the dictionary?

What am I doing wrong?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions