Covariance-Contravariance help please!
-
Can you help me with how to use covariance contravariance for the example below? I am calling a WCF service and want to convert List object returned from service to List object in my wpf app. How to do that?
EmployeeSrv.EmpClient EmployeeSrvc = new EmployeeSrv.EmpClient();
List lstEmployee = new List();
lstEmployee = EmployeeSrv.GetEmployeeDetails();
List lstEmpWPF = lstEmployee; //This errors and here covariance has to be used------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates
-
Can you help me with how to use covariance contravariance for the example below? I am calling a WCF service and want to convert List object returned from service to List object in my wpf app. How to do that?
EmployeeSrv.EmpClient EmployeeSrvc = new EmployeeSrv.EmpClient();
List lstEmployee = new List();
lstEmployee = EmployeeSrv.GetEmployeeDetails();
List lstEmpWPF = lstEmployee; //This errors and here covariance has to be used------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates
2 thing come to mind, if they are the same why do you care which one you use? and
List lstEmpWPF = new List(lstEmployee);
Never underestimate the power of human stupidity RAH