Reputation: 25
My dll have a method. This method have to return some data which are represented with class. I try to return this data with List<> but it not work.I get error that: The type is defined in an assembly that is not referenced. You must add reference to assembly. My dll like this:
public class CLASSA{
public List<CLASSB> function(){
}
}
And Main will be like this:
void functionMainn(){
CLASSA cls;
gridView.DataSource = cls.function();
}
How can I fix it or return these values as data source of gridview.
Upvotes: 0
Views: 507
Reputation: 61369
As the error says; to utilize a type returned by DLL A but defined in DLL B you need a reference to both A and B. Add those references and it will work fine.
Also, make sure to instantiate cls
before using it.
Upvotes: 4