开发者

use a class in another DLL in C#

I have a project in which i created a class called "validator".

i also created a DLL that has开发者_如何学JAVA a function that i want to pass the validator class as a parameter. but the DLL doesn't know the class in my project cause it is a different DLL.

i also can't add a reference in the dll to the project because the project has already a reference to the DLL (can't make circular references).

how do i get the DLL to recognize the validator class?


Define an interface in the DLL, that has the needed functions (like bool Validate()).

Have the validator class implement the interface and give it to the DLL.


Sounds like you need 1) a redesign or 2) a refactoring effort that creates a third class library that can be used by both of your current DLLs.


does it have to be a parameter? Can't u just create a non-static method? If you really want to , sounds like you have to create another project and build a different class.( that's if you want to reference the method using dll)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜