ObsoleteAttribute クラスとは? わかりやすく解説

ObsoleteAttribute クラス

今後使用しないプログラム要素マーク付けます。このクラス継承できません。

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

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct
 Or AttributeTargets.Enum Or AttributeTargets.Constructor
 Or AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Event
 Or AttributeTargets.Interface Or AttributeTargets.Delegate, Inherited:=False)> _
Public NotInheritable Class
 ObsoleteAttribute
    Inherits Attribute
Dim instance As ObsoleteAttribute
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Event|AttributeTargets.Interface|AttributeTargets.Delegate,
 Inherited=false)] 
public sealed class ObsoleteAttribute : Attribute
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Enum|AttributeTargets::Constructor|AttributeTargets::Method|AttributeTargets::Property|AttributeTargets::Field|AttributeTargets::Event|AttributeTargets::Interface|AttributeTargets::Delegate,
 Inherited=false)] 
public ref class ObsoleteAttribute sealed :
 public Attribute
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Event|AttributeTargets.Interface|AttributeTargets.Delegate,
 Inherited=false) */ 
public final class ObsoleteAttribute extends
 Attribute
SerializableAttribute 
ComVisibleAttribute(true) 
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Event|AttributeTargets.Interface|AttributeTargets.Delegate,
 Inherited=false) 
public final class ObsoleteAttribute extends
 Attribute
解説解説
使用例使用例

ObsoleteAttributeマークされメソッド含まれるクラス定義する例を次に示します。このメソッド呼び出すコードでは、コンパイラによって警告出力されます。

using System;

public sealed class App {
   static void Main() {      
      // The line below causes the compiler to issue a warning:
      // 'App.SomeDeprecatedMethod()' is obsolete: 'Do not call this
 method.'
      SomeDeprecatedMethod();
   }

   // The method below is marked with the ObsoleteAttribute. 
   // Any code that attempts to call this method will get a warning.
   [Obsolete("Do not call this method.")]
   private static void SomeDeprecatedMethod()
 { }
}

using namespace System;


// The method below is marked with the ObsoleteAttribute.
// Any code that attempts to call this method will get a warning.
[Obsolete("Do not call this method.")]
void SomeDeprecatedMethod()
{
}

int main()
{
    // The line below causes the compiler to issue a warning:
    // 'SomeDeprecatedMethod()': marked as obsolete
    // Message: 'Do not call this method.'
    SomeDeprecatedMethod();
}

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


このページでは「.NET Framework クラス ライブラリ リファレンス」からObsoleteAttribute クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からObsoleteAttribute クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からObsoleteAttribute クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ObsoleteAttribute クラス」の関連用語

ObsoleteAttribute クラスのお隣キーワード
検索ランキング

   

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



ObsoleteAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS