ResourceConsumptionAttributeとは? わかりやすく解説

ResourceConsumptionAttribute クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

クラスのメンバが消費するリソースを指定します。このクラスは継承できません。

名前空間: System.Runtime.Versioning
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Constructor Or AttributeTargets.Method
 Or AttributeTargets.Property, Inherited:=False)> _
<ConditionalAttribute("RESOURCE_ANNOTATION_WORK")>
 _
Public NotInheritable Class
 ResourceConsumptionAttribute
    Inherits Attribute
Dim instance As ResourceConsumptionAttribute
[AttributeUsageAttribute(AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property,
 Inherited=false)] 
[ConditionalAttribute("RESOURCE_ANNOTATION_WORK")] 
public sealed class ResourceConsumptionAttribute
 : Attribute
[AttributeUsageAttribute(AttributeTargets::Constructor|AttributeTargets::Method|AttributeTargets::Property,
 Inherited=false)] 
[ConditionalAttribute(L"RESOURCE_ANNOTATION_WORK")] 
public ref class ResourceConsumptionAttribute
 sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property,
 Inherited=false) */ 
/** @attribute ConditionalAttribute("RESOURCE_ANNOTATION_WORK") */ 
public final class ResourceConsumptionAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property,
 Inherited=false) 
ConditionalAttribute("RESOURCE_ANNOTATION_WORK") 
public final class ResourceConsumptionAttribute
 extends Attribute
解説解説

ResourceConsumptionAttribute 属性をメンバに適用している場合は、ResourceExposureAttribute 属性も適用する必要があります。

リソースが消費されているスコープが、リソースが公開されているスコープと異なる場合は、consumptionScope パラメータを受け取るコンストラクタを使用して、公開されているスコープを指定する必要があります。たとえば、リソースが Machine リソースとして公開されていても、実際には Process と Assembly のスコープだけで使用されている場合があります。この例の場合、consumptionScope パラメータを Process | Assembly に設定します。

コンストラクタの resourceScope パラメータでは、呼び出されるすべてのメンバのリソース公開範囲以上の ResourceScope を指定する必要があります。たとえば、2 つの Process リソースと 1 つの Machine リソースを消費するメソッドは、resourceScope を Machine | Process に設定することによって、Machine リソースと Process リソースを消費するものとして指定します。

Public メンバは Assembly リソースや Private リソースを公開できません。また、Assembly メンバは Private リソースを公開できません。

リソース スコープが None の ResourceExposureAttribute 属性をメソッドに適用すると、メソッドのグラフは終了します。

継承階層継承階層
System.Object
   System.Attribute
    System.Runtime.Versioning.ResourceConsumptionAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ResourceConsumptionAttribute メンバ
System.Runtime.Versioning 名前空間

ResourceConsumptionAttribute コンストラクタ (ResourceScope)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

リソースが消費されるスコープを指定して、ResourceConsumptionAttribute クラスの新しいインスタンスを初期化します。

名前空間: System.Runtime.Versioning
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    resourceScope As ResourceScope _
)
Dim resourceScope As ResourceScope

Dim instance As New ResourceConsumptionAttribute(resourceScope)
public ResourceConsumptionAttribute (
    ResourceScope resourceScope
)
public:
ResourceConsumptionAttribute (
    ResourceScope resourceScope
)
public ResourceConsumptionAttribute (
    ResourceScope resourceScope
)
public function ResourceConsumptionAttribute
 (
    resourceScope : ResourceScope
)

パラメータ

resourceScope

リソースが消費される ResourceScope。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ResourceConsumptionAttribute クラス
ResourceConsumptionAttribute メンバ
System.Runtime.Versioning 名前空間

ResourceConsumptionAttribute コンストラクタ (ResourceScope, ResourceScope)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

リソースが消費されるスコープとリソースが公開されるスコープを指定して、ResourceConsumptionAttribute クラスの新しいインスタンスを初期化します。

名前空間: System.Runtime.Versioning
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    resourceScope As ResourceScope, _
    consumptionScope As ResourceScope _
)
Dim resourceScope As ResourceScope
Dim consumptionScope As ResourceScope

Dim instance As New ResourceConsumptionAttribute(resourceScope,
 consumptionScope)
public ResourceConsumptionAttribute (
    ResourceScope resourceScope,
    ResourceScope consumptionScope
)
public:
ResourceConsumptionAttribute (
    ResourceScope resourceScope, 
    ResourceScope consumptionScope
)
public ResourceConsumptionAttribute (
    ResourceScope resourceScope, 
    ResourceScope consumptionScope
)
public function ResourceConsumptionAttribute
 (
    resourceScope : ResourceScope, 
    consumptionScope : ResourceScope
)

パラメータ

resourceScope

リソースが消費される ResourceScope。

consumptionScope

このメンバが使用する ResourceScope。

解説解説

ResourceExposureAttribute 属性で None のスコープが指定されている場合、ResourceConsumptionAttribute 属性では、consumptionScope パラメータの値を指定して、消費するリソースとその消費方法を指定する必要があります。

consumptionScope で指定されるスコープは、resourceScope で指定されるスコープ以下である必要があります。たとえば、Process スコープは Process スコープまたは AppDomain スコープとして消費できますが、Machine スコープとしては消費できません。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ResourceConsumptionAttribute クラス
ResourceConsumptionAttribute メンバ
System.Runtime.Versioning 名前空間

ResourceConsumptionAttribute コンストラクタ

ResourceConsumptionAttribute クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
ResourceConsumptionAttribute (ResourceScope) リソースが消費されるスコープを指定して、ResourceConsumptionAttribute クラスの新しいインスタンスを初期化します。
ResourceConsumptionAttribute (ResourceScope, ResourceScope) リソースが消費されるスコープとリソースが公開されるスコープを指定して、ResourceConsumptionAttribute クラスの新しいインスタンスを初期化します。
参照参照

関連項目

ResourceConsumptionAttribute クラス
ResourceConsumptionAttribute メンバ
System.Runtime.Versioning 名前空間

ResourceConsumptionAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ ConsumptionScope このメンバの消費スコープを取得します。
パブリック プロパティ ResourceScope リソースが消費されているスコープを取得します。
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。)
参照参照

関連項目

ResourceConsumptionAttribute クラス
System.Runtime.Versioning 名前空間

ResourceConsumptionAttribute メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
参照参照

関連項目

ResourceConsumptionAttribute クラス
System.Runtime.Versioning 名前空間

ResourceConsumptionAttribute メンバ

クラスのメンバが消費するリソースを指定します。このクラスは継承できません。

ResourceConsumptionAttribute データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ResourceConsumptionAttribute オーバーロードされます。 ResourceConsumptionAttribute クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ ConsumptionScope このメンバの消費スコープを取得します。
パブリック プロパティ ResourceScope リソースが消費されているスコープを取得します。
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。)
パブリック メソッドパブリック メソッド
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
参照参照

関連項目

ResourceConsumptionAttribute クラス
System.Runtime.Versioning 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「ResourceConsumptionAttribute」の関連用語

ResourceConsumptionAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ResourceConsumptionAttributeのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS