AllowPartiallyTrustedCallersAttribute.PartialTrustVisibilityLevel Property

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the default partial trust visibility for code that is marked with the AllowPartiallyTrustedCallersAttribute (APTCA) attribute.

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

public PartialTrustVisibilityLevel PartialTrustVisibilityLevel { get; set; }

Property Value

Type: System.Security.PartialTrustVisibilityLevel

One of the enumeration values. The default is VisibleToAllHosts.

The following examples demonstrate how to use this property.

  • Default, unconditional APTCA:

    [assembly: AllowPartiallyTrustedCallers]
    

    Defaults to VisibleToAllHosts.

  • Explicit, unconditional APTCA:

    [assembly: AllowPartiallyTrustedCallers(PartialTrustVisibilityLevel=VisibleToAllHosts)]
    

    The assembly can always be called by partial-trust code.

  • Explicit, conditional APTCA:

    [assembly: AllowPartiallyTrustedCallers(PartialTrustVisibilityLevel=NotVisibleByDefault)]
    

    The assembly has been audited for partial trust, but it is not visible to partial-trust code by default. To make the assembly visible to partial-trust code, add it to the AppDomainSetup.PartialTrustVisibleAssemblies property.

.NET Framework
Available since 4.0
Return to top
Show: