c# - Cannot convert type 'System.Collections.Generic.List<website.Class1>' to 'System.Collections.Generic.List<library.Class1>' -


i'm using mvc on .net 4.5.

i have separated models website class library, , have tt class file of .edmx replicated website can access model classes.

though when return data library this,

list<website.class1> = objlibraryref.getfilelists1(); 

i error.

cannot convert type 'system.collections.generic.list<website.class1>' 'system.collections.generic.list<library.class1>' 

i don't want reference class library accessing model classes.

any appreciated. & cheers.

you have convert library.class1 website.class1. if have same name classes different because in separate libraries.

list<website.class1> = objlibraryref.getfilelists1()                          .select(c => new website.class1 {                                    property1 = c.property1,                                    ...                                    propertyn = c.propertyn                           }).tolist(); 

note: replace property1..n properties (i.e. name). don't have reference library library.class1 created.


Comments