#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
}
}