开发者

When i need to reference my referenced assembly reference

开发者 https://www.devze.com 2023-02-28 03:43 出处:网络
Sorry i know that my question is complicated, some time when i reference an assembly i notes thats not important to reference also it\'s dependency but i开发者_StackOverflow社区n other time the compil

Sorry i know that my question is complicated, some time when i reference an assembly i notes thats not important to reference also it's dependency but i开发者_StackOverflow社区n other time the compiler complaint plz i want to know when it mandatory and when it not


You have to add a reference to the "child" dependency if you're using a class in the "main" reference which in turn mentions that child dependency in its API. For example:

public class ClassInLibrary
{
    public void Foo(ClassInChildDependency x)
    {
    }
}

In order to use ClassInLibrary, you have to add a reference to the dependency so that the compiler knows what Foo looks like. Ditto if the class inherits from another class in the dependency library, etc.

If you're using a class which has no connection to the dependency, you should be okay at compile-time... but you may well need the dependency at execution time anyway.

0

精彩评论

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