2 回答

TA貢獻1874條經(jīng)驗 獲得超12個贊
應該是消除.net版本/代碼過期警告用的吧~~在使用這個語句的時候2.0的編譯器會提示推薦使用 ConfigurationManager這個來訪問配置文件.

TA貢獻1805條經(jīng)驗 獲得超9個贊
#pragma warning disable 618 表示從這一行開始,本文件內如果觸發(fā)了編號為0618的警告的話,不要提示. #pragma warning restore 618 則與上一個相反,從此行以后繼續(xù)提示相關的警告. 在MSDN Library的索引頁輸入CS0618即可找到對應的編譯警告說明: Compiler Warning (level 2) CS0618 Error Message 'member' is obsolete: '****' A class member was marked with the Obsolete attribute, such that a warning will be issued when the class member is referenced. The following sample generates CS0618: // CS0618.cs // compile with: /W:2 using System; public class C { [Obsolete("Use newMethod instead", false)] // warn if referenced public static void m2() { } public static void newMethod() { } } class MyClass { public static void Main() { C.m2(); // CS0618 } }
- 2 回答
- 0 關注
- 542 瀏覽
添加回答
舉報