ObsoleteAttribute コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ObsoleteAttribute コンストラクタの意味・解説 

ObsoleteAttribute コンストラクタ (String, Boolean)

代替手段メッセージと、今後使用しないマークされ要素使用するエラーになるかどうかを示す Boolean 値を指定して、ObsoleteAttribute クラス新しインスタンス初期化します。

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

解説解説
使用例使用例
Imports System

Public Class ObsoleteAttrib_Cons1
   ' Mark the method as 'Obsolete' with message and IsError as parameters.
   <ObsoleteAttribute("This function will be removed from
 future Versions.Use another function 'NewFunction'",
 False)> _
   Public Function OldFunction() As
 String
      OldFunction= "This is the String from old function."
   End Function 'OldFunction

   ' Create the another function which is replacement to the 'OldFunction'.
   Public Function NewFunction() As
 String
      Return "This is the String from new function."
   End Function 'NewFunction
End Class 'ObsoleteAttrib_Cons1

Public Class TestObsolete3
   'Entry point which delegates to C-style main Private Function
   Public Overloads Shared
 Sub Main()
      Main(System.Environment.GetCommandLineArgs())
   End Sub

   Overloads Shared Sub
 Main(args() As String)
      Try
         Dim myObsolete As New
 ObsoleteAttrib_Cons1()
         Console.WriteLine(myObsolete.OldFunction())
         Console.WriteLine(myObsolete.NewFunction())
      Catch e As Exception
         Console.WriteLine(("The Exception is :" +
 e.Message))
      End Try
   End Sub 'Main
End Class 'TestObsolete3
using System;

public class ObsoleteAttrib_Cons1
{

   // Mark the method as 'Obsolete' with message and IsError as parameters.
   [ObsoleteAttribute("This function will be removed from future Versions.Use
 another function 'NewFunction'",false)]
   public string OldFunction()
   {
      return "This is the String from old function.";
   }
   // Create the another function which is replacement to the 'OldFunction'.
   public string NewFunction()
   {
      return "This is the String from new
 function.";
   }

}
public class TestObsolete3
{
   static void Main(string[]
 args)
   {            
      try
      {
         ObsoleteAttrib_Cons1 myObsolete = new ObsoleteAttrib_Cons1();
         Console.WriteLine(myObsolete.OldFunction());
         Console.WriteLine(myObsolete.NewFunction());
      }
      catch(Exception e)
      {
         Console.WriteLine("The Exception is :"+e.Message);
      }
   }
}
using namespace System;
public ref class ObsoleteAttrib_Cons1
{
public:

   // Mark the method as 'Obsolete' with message and IsError as parameters.

   [ObsoleteAttribute("This function will be removed from future Versions. Use
 another function 'NewFunction'",false)]
   String^ OldFunction()
   {
      return "This is the String from old function.";
   }


   // Create another function which is replacement to the 'OldFunction'.
   String^ NewFunction()
   {
      return "This is the String from new
 function.";
   }

};

int main()
{
   try
   {
      ObsoleteAttrib_Cons1^ myObsolete = gcnew ObsoleteAttrib_Cons1;
      Console::WriteLine( myObsolete->OldFunction() );
      Console::WriteLine( myObsolete->NewFunction() );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "The Exception is : {0}", e->Message );
   }

}

import System.*;
public class ObsoleteAttrib_Cons1
{
    // Mark the method as 'Obsolete' with message and IsError as parameters.
    /** @attribute ObsoleteAttribute("This function will be removed from future"
       + "Versions.Use another function 'NewFunction'", false)
     */
    public String OldFunction()
    {
        return "This is the String from old function.";
    } //OldFunction

    // Create the another function which is replacement to the 'OldFunction'.
    public String NewFunction()
    {
        return "This is the String from new
 function.";
    } //NewFunction
} //ObsoleteAttrib_Cons1

public class TestObsolete3
{
    public static void main(String[]
 args)
    {
        try {
            ObsoleteAttrib_Cons1 myObsolete = new ObsoleteAttrib_Cons1();
            Console.WriteLine(myObsolete.OldFunction());
            Console.WriteLine(myObsolete.NewFunction());
        }
        catch (System.Exception e) {
            Console.WriteLine("The Exception is :" + e.get_Message());
        }
    } //main
} //TestObsolete3
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ObsoleteAttribute クラス
ObsoleteAttribute メンバ
System 名前空間

ObsoleteAttribute コンストラクタ (String)

代替手段メッセージ指定して、ObsoleteAttribute クラス新しインスタンス初期化します。

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

解説解説
使用例使用例
Imports System

Public Class ObsoleteAttrib_Cons1
   ' Mark the method as 'Obsolete' with message as parameter.
   <ObsoleteAttribute("This function will be removed from
 future Versions.Use another function 'NewFunction'")>
 _
   Public Function OldFunction() As
 String
      OldFunction= "This is the String from old function."
   End Function 'OldFunction

   ' Create the another function which is replacement to the 'OldFunction'.
   Public Function NewFunction() As
 String
      NewFunction= "This is the String from new function."
   End Function 'NewFunction
End Class 'ObsoleteAttrib_Cons1

Public Class TestObsolete2
   'Entry point which delegates to C-style main Private Function
   Public Overloads Shared
 Sub Main()
      Main(System.Environment.GetCommandLineArgs())
   End Sub
   Overloads Shared Sub
 Main(args() As String)
      Try
         Dim myObsolete As New
 ObsoleteAttrib_Cons1()
         Console.WriteLine(myObsolete.OldFunction())
         Console.WriteLine(myObsolete.NewFunction())
      Catch e As Exception
         Console.WriteLine(("The Exception is :" +
 e.Message))
      End Try
   End Sub 'Main
End Class 'TestObsolete2
using System;
public class ObsoleteAttrib_Cons1
{
   // Mark the method as 'Obsolete' with message as parameter.
   [ObsoleteAttribute("This function will be removed from future Versions.Use
 another function 'NewFunction'")]
   public string OldFunction()
   {
      return "This is the String from old function.";
   }
   // Create the another function which is replacement to the 'OldFunction'.
   public string NewFunction()
   {
      return "This is the String from new
 function.";
   }
}

public class TestObsolete2
{
   static void Main(string[]
 args)
   {               
      try
      {
         ObsoleteAttrib_Cons1 myObsolete = new ObsoleteAttrib_Cons1();
         Console.WriteLine(myObsolete.OldFunction());
         Console.WriteLine(myObsolete.NewFunction());
      }
      catch(Exception e)
      {
         Console.WriteLine("The Exception is :"+e.Message);
      }
   }
}
using namespace System;
public ref class ObsoleteAttrib_Cons1
{
public:

   // Mark the method as 'Obsolete' with message as parameter.

   [ObsoleteAttribute("This function will be removed from future Versions. Use
 another function 'NewFunction'")]
   String^ OldFunction()
   {
      return "This is the String from old function.";
   }


   // Create another function which is replacement to the 'OldFunction'.
   String^ NewFunction()
   {
      return "This is the String from new
 function.";
   }

};

int main()
{
   try
   {
      ObsoleteAttrib_Cons1^ myObsolete = gcnew ObsoleteAttrib_Cons1;
      Console::WriteLine( myObsolete->OldFunction() );
      Console::WriteLine( myObsolete->NewFunction() );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "The Exception is : {0}", e->Message );
   }

}

import System.*;

public class ObsoleteAttrib_Cons1
{
    // Mark the method as 'Obsolete' with message as parameter.

    /** @attribute ObsoleteAttribute("This function will be removed from future"
        + "Versions.Use another function 'NewFunction'")
     */
    public String OldFunction()
    {
        return "This is the String from old function.";
    } //OldFunction

    // Create the another function which is replacement to the 'OldFunction'.
    public String NewFunction()
    {
        return "This is the String from new
 function.";
    } //NewFunction
} //ObsoleteAttrib_Cons1

public class TestObsolete2
{
    public static void main(String[]
 args)
    {
        try {
            ObsoleteAttrib_Cons1 myObsolete = new ObsoleteAttrib_Cons1();
            Console.WriteLine(myObsolete.OldFunction());
            Console.WriteLine(myObsolete.NewFunction());
        }
        catch (System.Exception e) {
            Console.WriteLine("The Exception is :" + e.get_Message());
        }
    } //main
} //TestObsolete2
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ObsoleteAttribute クラス
ObsoleteAttribute メンバ
System 名前空間

ObsoleteAttribute コンストラクタ


ObsoleteAttribute コンストラクタ ()

ObsoleteAttribute クラス新しインスタンス既定プロパティ使用して初期化します。

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

Dim instance As New ObsoleteAttribute
public ObsoleteAttribute ()
public:
ObsoleteAttribute ()
public ObsoleteAttribute ()
public function ObsoleteAttribute ()
解説解説

ObsoleteAttributeインスタンス初期プロパティ値を次の表に示します

プロパティ

IsError

false

Message

null 参照 (Visual Basic では Nothing)

使用例使用例
Imports System

Public Class ObsoleteAttrib_Cons1
   ' Mark the method as 'Obsolete'.
   <ObsoleteAttribute()> Public Function
 OldFunction() As String
      Return "This is the String from old function."
   End Function 'OldFunction
   
   ' Create the another function which is replacement to the 'OldFunction'.
   Public Function NewFunction() As
 String
      Return "This is the String from new function."
   End Function 'NewFunction
End Class 'ObsoleteAttrib_Cons1

Public Class TestObsolete1
   'Entry point which delegates to C-style main Private Function
   Public Overloads Shared
 Sub Main()
      Main(System.Environment.GetCommandLineArgs())
   End Sub
   
   Overloads Shared Sub
 Main(args() As String)
      Try
         Dim myObsolete As New
 ObsoleteAttrib_Cons1()
         Console.WriteLine(myObsolete.OldFunction())
      Catch e As Exception
         Console.WriteLine(("The Exception is :" +
 e.Message))
      End Try
   End Sub 'Main
End Class 'TestObsolete1
using System;

public class ObsoleteAttrib_Cons1
{
   // Mark the method as 'Obsolete'.
   [ObsoleteAttribute()]
   public string OldFunction()
   {
      return "This is the String from old function.";
   }
   
// Create the another function which is replacement to the 'OldFunction'.
   public string NewFunction()
   {
      return "This is the String from new
 function.";
   }
}

public class TestObsolete1
{
   static void Main(string[]
 args)
   {         
      try
      {
         ObsoleteAttrib_Cons1 myObsolete = new ObsoleteAttrib_Cons1();
         Console.WriteLine(myObsolete.OldFunction());
      }
      catch(Exception e)
      {
         Console.WriteLine("The Exception is :"+e.Message);
      }
   }
}
using namespace System;
public ref class ObsoleteAttrib_Cons1
{
public:

   // Mark the method as 'Obsolete'.

   [Obsolete]
   String^ OldFunction()
   {
      return "This is the String from old function.";
   }


   // Create the another function which is replacement to the 'OldFunction'->
   String^ NewFunction()
   {
      return "This is the String from new
 function.";
   }

};

int main()
{
   try
   {
      ObsoleteAttrib_Cons1^ myObsolete = gcnew ObsoleteAttrib_Cons1;
      Console::WriteLine( myObsolete->OldFunction() );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "The Exception is : {0}", e->Message );
   }

}

import System.*;

public class ObsoleteAttrib_Cons1
{
    // Mark the method as 'Obsolete'.\

    /** @attribute ObsoleteAttribute()
     */
    public String OldFunction()
    {
        return "This is the String from old function.";
    } //OldFunction

    // Create the another function which is replacement to the 'OldFunction'.
    public String NewFunction()
    {
        return "This is the String from new
 function.";
    } //NewFunction
} //ObsoleteAttrib_Cons1

public class TestObsolete1
{
    public static void main(String[]
 args)
    {
        try {
            ObsoleteAttrib_Cons1 myObsolete = new ObsoleteAttrib_Cons1();
            Console.WriteLine(myObsolete.OldFunction());
        }
        catch (System.Exception e) {
            Console.WriteLine("The Exception is :" + e.get_Message());
        }
    } //main
} //TestObsolete1
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ObsoleteAttribute クラス
ObsoleteAttribute メンバ
System 名前空間


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

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

辞書ショートカット

すべての辞書の索引

「ObsoleteAttribute コンストラクタ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS