我试图在一个非常简单的C#文件中抑制警告,但是它无法正常工作,我找不到我在这里做错了什么.为什么Visual Studio仍会在这一小段代码中显示"无法访问的代码".
#pragma warning disable 429
// I've got the number from:
// http://msdn.microsoft.com/en-us/library/2ch1a3w5.aspx
// This below does work, so I might have the wrong number for the warning?
// #pragma warning disable
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("test");
if (false)
return;
return;
MessageBox.Show("test");
}
}
}
Run Code Online (Sandbox Code Playgroud)