当前位置:首页 > C#教程 > C#进阶

C#属性已过时

using System;

public class MyClass {
   [Obsolete("Don't use OldMethod, use NewMethod instead", true)]

   static void OldMethod() {
      Console.WriteLine("It is the old method");
   }

   static void NewMethod() {
      Console.WriteLine("It is the new method"); 
   }

   public static void Main() {
      OldMethod();
   }
}

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!