AllowPartiallyTrustedCallersAttribute.PartialTrustVisibilityLevel Property

Definition

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

C#
public System.Security.PartialTrustVisibilityLevel PartialTrustVisibilityLevel { get; set; }

Property Value

One of the enumeration values. The default is VisibleToAllHosts.

Remarks

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.

Applies to

Продукт Версії
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1