I'm developing a .NET 开发者_如何学CWINDOWS FORM Application , I need to develop a search module and this search could be used in many other applications,
i'm wondering what is best to to Develeop Search as :
DLL and include it in the Application
OR
EXE file and execute it from other applications
what is the Advantages and Disadvantages for each way????
I would go with putting the form in a class library and then adding it as a reference to all the projects I need it. Shelling out and executing it in a separate executable sounds messy. You also lose the ability to interact with the form object.
If the search module is going to be used in many application, I recommend that you create it as a DLL (Class Library) and use it from the applications.
Advantages :
- It's easier to reuse code
- You don't have to track multiple versions of the search module if it's going to be updated/maintained in the future (You deploy only the DLL)
- You can easily get another developer to work on this feature while you work on something else.
Disadvantages:
- It's a pain switching projects in VS, especially if you already have many in the same solution
Generally, it is preferred to use a DLL and add it to your project as reference. Some advantages are:
- You can reuse the classes, you don't have to implement some kind of inter-process communication
- Starting a new application costs a lot of time as compared to instantiating a new class
精彩评论