Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Covariance-Contravariance help please!

Covariance-Contravariance help please!

Scheduled Pinned Locked Moved WPF
csharptutorialwpfwcfhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DotNetXenon
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • D DotNetXenon

      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

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups