2 回答
TA贡献1874条经验 获得超12个赞
应该是消除.net版本/代码过期警告用的吧~~在使用这个语句的时候2.0的编译器会提示推荐使用 ConfigurationManager这个来访问配置文件.
TA贡献1805条经验 获得超9个赞
#pragma warning disable 618 表示从这一行开始,本文件内如果触发了编号为0618的警告的话,不要提示. #pragma warning restore 618 则与上一个相反,从此行以后继续提示相关的警告. 在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 关注
- 502 浏览
添加回答
举报