在C#下面粗略示例代码我对宣布条件的字符串,我无法访问它的是支具在C#全局声明一个字符串
if(//some condition)
{
string value1 = "something";
}
//push to database value1
在上面的代码编译说:The name 'value1' does not exists in the current context
我需要以这样一种方式声明value1
,它必须在整个页面中进行访问。我试过protected value1
,但那也不起作用。我讨厌把它作为一个单独的课程来使用。无论如何要宣布全球?