c# - Conversion error while fetching data from WCF service -


servicereference1.service1client ser = new servicereference1.service1client();         list<onetimeworkout> list = ser.getonetimeworkouts().tolist();     

i'm trying list of onetimeworkout objects, error:

cannot implicitly convert typ system.collections.generic.list<wn.manager.servicereference1.onetimeworkout> system.collections.generic.list<wn.models.onetimeworkout>

my service reference configured reuse types in referenced assemblies.

my service method:

public list<onetimeworkout> getonetimeworkouts() {     return new businesslogic.businesslogic().getonetimeworkouts(); }    

another problem cannot create

var list = ser.getonetimeworkouts().tolist();    

instead of generic list because later need pass method , var list seems not working (still same error)

there several similar questions asked in stackoverflow, yet none of these answers seems working me.

the fact error mentions wn.manager.servicereference1.onetimeworkout indicates service reference not reuse types of referenced assemblies.

you can change service reference selecting in solution explorer , choose configure service reference. in dialog make sure reuse types in referenced assemblies checked.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -