"Application Scenario"
Assembly A accesses the members of the class that are defined by Assembly b for the Internal access type.
"How to use"
When building Assembly B , introduce System.Runtime.CompilerServicesto add InternalsVisibleTo attribute
Example
Assembly b--
using System; using System.Runtime.CompilerServices; // for InternalsVisibleTo Properties // the internal types in the current assembly can be set by the following assemblies // any code access (no matter what version or language culture) [Assembly:internalsvisibleto (" Assembly A's name, publickey=1234 ... " )]internalsealedclass someinternaltype{...}
Assembly a--
using System; Internal Sealed class Foo { privatestatic Object SomeMethod () { // This assembly a can access the internal type in another assembly ,// as if it were a public type new Someinternaltype (); return sit; }}
Note
Do not specify a version number when adding InternalsVisibleTo attribute, language culture and processor architecture
Read Classics-CLR via C # (Jeffrey Richter) Notes _ Friend Assemblies