【发布时间】:2012-03-07 06:08:33
【问题描述】:
我是 C# 新手,我真的需要知道如何从另一个方法调用/使用字符串。
例如:
public void button1_Click(object sender, EventArgs e)
{
string a = "help";
}
public void button2_Click(object sender, EventArgs e)
{
//this is where I need to call the string "a" value from button1_click
string b = "I need ";
string c = b + a;
}
在这个例子中,我需要从函数button2_Click()调用函数button1_Click()中定义的字符串“a”
【问题讨论】: