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)

property HostProtectionResource Resources {
	HostProtectionResource get();
	void set(HostProtectionResource value);

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.
// Exit the sample when an exception is thrown.

static void Exit( String^ Message, int Code )
   Console::WriteLine( "\nFAILED: {0} {1}", Message, Code );
   Environment::ExitCode = Code;
   Environment::Exit( Code );

.NET Framework
Available since 2.0
Return to top