Updated: July 2009
Specifies that types that are ordinarily visible only within the current assembly are visible to another assembly.
Namespace:
System.Runtime.CompilerServices
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple := True, Inherited := False)> _
Public NotInheritable Class InternalsVisibleToAttribute _
Inherits Attribute
Dim instance As InternalsVisibleToAttribute
[AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class InternalsVisibleToAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Assembly, AllowMultiple = true, Inherited = false)]
public ref class InternalsVisibleToAttribute sealed : public Attribute
public final class InternalsVisibleToAttribute extends Attribute
This attribute applies to internal types in C#, friend types in Visual Basic, and all types at namespace or global scope in C++. To apply this attribute to a strong-named friend assembly, you must know the hexadecimal string that represents the public key of the friend assembly. For more information, see How to: Sign an Assembly with a Strong Name.
Do not include values for the CultureInfo, Version, or ProcessorArchitecture fields in the string parameter of the friend assembly declaration. The Visual Basic, C#, and C++ compilers treat this as a compile error. If you use a compiler (such as the MSIL Assembler (Ilasm.exe)) that does not treat it as an error and the assemblies are strong-named, a MethodAccessException is thrown the first time the specified friend assembly accesses the assembly that contains InternalsVisibleToAttribute.
For comprehensive information about how to use this attribute, see the following topics:
System..::.Object
System..::.Attribute
System.Runtime.CompilerServices..::.InternalsVisibleToAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
.NET Compact Framework
Supported in: 3.5, 2.0
XNA Framework
Supported in: 3.0, 2.0, 1.0
Reference
Date | History | Reason |
|---|
July 2009
| Added links; removed incomplete example. |
Information enhancement.
|