在同一解决方案中的两个项目之间共享一个类对象
问题描述:
有人可以告诉我解决方案中的两个项目之间是否可以共享一个类吗?我的意思是,如果解决方案中的两个项目都可以访问该类的实例.
Can someone please tell me if it is possible to share a class between two projects in a solution? What I mean by this is if an instance of the class can be accessed by both projects in my solution.
链接到示例很好.
谢谢
Harriet
答
如果一个人是一个exe文件,另一个人是一个DLL,那么是的,这应该是微不足道的.如果它们都是exe,则可以通过WPF之类的机制交换对象(但它是对象的副本),或者如果将其作为远程对象托管,则另一个exe可以访问它. 通过WCF代理.
If one's an exe and the other's a DLL, then yeah it should be trivial. If they are both exes you can exchange the object through mechanisms such as WPF (but it'd be a copy of the object), or if you host it as a remote object, the other exe can access it via the WCF proxy.