When i need to reference my referenced assembly reference
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.
精彩评论