Have you ever had a class library that uses an Interface? How about two or more libraries that need to use the same Interface? For instance, ClassLibrary1 and ClassLibrary2 need to implement ISomeInterface below:
Instead of copying ISomeInterface.vb to both ClassLibrary projects or adding a project reference, you can add a link to ISomeInterface.vb and have access to ISomeInterface:
Now you’ll notice that ISomeInterface.vb is part of ClassLibrary1 as a linked file:
Now we can implement ISomeInterface in ClassLibrary1:
The benefit of adding the Interface file as a link is that you can maintain the Interface in one location. You don’t have to worry about having to copy new versions if you decide to change your contract.
No comments:
Post a Comment