I have a bunch of winform control libraries in my visual studio 2008 after I installed a third party.
How can I import those controls to my own custom library? For example
Instead of using ThirdPartyAssembly.ControlName
I can use MyAssembly.CotrolName
(all controls still have full functionality the same as开发者_开发技巧 the original)
Can anyone please give me an example?
You can not import thirdparty controls into your own library. You can only reference them. You can use namespace alias feature if want to reference these controls in code under a different name:
using MyNamespace = ThirdPartyNamespace;
...
var control = new MyNamespace.ControlName();
If you are dealing with two versions of the same thirdparty dll you can use extern alias. Read this or this:
extern alias ThirdPartyAssemblyV1;
extern alias ThirdPartyAssemblyV2;
...
var v1 = new ThirdPartyAssemblyV1::Namespace.ControlName();
var v2 = new ThirdPartyAssemblyV2::Namespace.ControlName();
It's seem like not possible. You can reference it. But another way can do it, package two difference library as assembly's resource, reflection to call method after extract to disk.
精彩评论