HostProtectionAttribute.Resources Property


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

Gets or sets flags specifying categories of functionality that are potentially harmful to the host.

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

Public Property Resources As HostProtectionResource

Property Value

Type: System.Security.Permissions.HostProtectionResource

A bitwise combination of the HostProtectionResource values. The default is None.

The HostProtectionResource flags specify the resources exposed by the method or class that are potentially harmful to the host.

The following code example illustrates the use of the HostProtectionAttribute attribute with the Resources property. This example is part of a larger example provided for the HostProtectionAttribute class.

' Use the enumeration flags to indicate that this method exposes 
' shared state and self-affecting process management.
' Either of the following attribute statements can be used to set the 
' resource flags.
<HostProtectionAttribute(SharedState := True, _
    SelfAffectingProcessMgmt := True), _
    HostProtectionAttribute( _
    Resources := HostProtectionResource.SharedState Or _
    HostProtectionResource.SelfAffectingProcessMgmt)> _
Private Shared Sub [Exit](ByVal Message As String, ByVal Code As Integer)

    ' Exit the sample when an exception is thrown.
    Console.WriteLine((ControlChars.Lf & "FAILED: " & Message & " " & _
    Environment.ExitCode = Code
End Sub 'Exit

.NET Framework
Available since 2.0
Return to top