編譯器警告 (層級 1) CS1635
更新:2007 年 11 月
錯誤訊息
無法還原警告 'warning code',因為它已全域停用
如果您使用 /nowarn 命令列選項或專案設定停用整個編譯單位 (Compilation Unit) 的警告,但使用 #pragma warning restore 嘗試還原警告,便會發生這個警告。若要解決這個錯誤,請移除 /nowarn 命令列選項或專案設定,或移除您透過命令列或專案設定停用的任何警告之 #pragma warning restore。如需詳細資訊,請參閱 #pragma warning 主題。
下列範例會產生 CS1635:
// CS1635.cs
// compile with: /w:1 /nowarn:162
enum MyEnum {one=1,two=2,three=3};
class MyClass
{
public static void Main()
{
#pragma warning disable 162
if (MyEnum.three == MyEnum.two)
System.Console.WriteLine("Duplicate");
#pragma warning restore 162
}
}