HostProtectionAttribute.Resources プロパティ

定義

ホストに害を及ぼす可能性がある機能のカテゴリを指定するフラグを取得または設定します。

C#
public System.Security.Permissions.HostProtectionResource Resources { get; set; }

プロパティ値

HostProtectionResource 値のビットごとの組み合わせ。 既定値は、None です。

次のコード例は、 プロパティで 属性を使用する HostProtectionAttribute 方法を Resources 示しています。 この例は、 クラスに対して提供される大きな例の HostProtectionAttribute 一部です。

C#
// 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 |
     HostProtectionResource.SelfAffectingProcessMgmt)]
private static void Exit(string Message, int Code)
{
    // Exit the sample when an exception is thrown.
    Console.WriteLine("\nFAILED: " + Message + " " + Code.ToString());
    Environment.ExitCode = Code;
    Environment.Exit(Code);
}

注釈

フラグは HostProtectionResource 、ホストに害を及ぼす可能性があるメソッドまたはクラスによって公開されるリソースを指定します。

適用対象

製品 バージョン
.NET Framework 2.0, 3.0, 3.5, 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
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

こちらもご覧ください