The attribute is applied at the assembly level.
This means that it can be included at the beginning of a source code file,
or it can be included in the AssemblyInfo file in a Visual Studio project.
You can use the attribute to specify a single friend assembly that can access
the internal types and members of the current assembly.
You can add the attribute at the beginning of a source code file. You can't mark a single method with it, see the MSDN - Documentation.
if you want to split the visible and non visible methods of a class, you could do the following:
In one file, define your visible methods and mark the file as visible:
InternalsVisibleTo("NameOfOtherAssembly")]
public partial class Foo
{
internal void Visible(){}
}
In the other file, define your non visible Methods:
public partial class Foo
{
internal void IsNotVisible(){}
}
public
is plan B. There are many cases where functionality could be useful but you want to restrict access. In my case it's a library used throughout the company, but this specific function is (and should only be) used by one specific version of the client. – Laurasia