我的計劃是有一些方法,其中有些是調用一些其他的方式,我的問題是,我想用一些數據的方法在以前的方法產生,我不某些特定數據知道我應該怎麼做。我如何可以存儲來自我的方法
namespace MyProg
{
public partial class MyProg: Form
{
public static void method1(string text)
{
//procedures
method2("some text");
// Here i want to use the value from string letter from method2.
}
public static void method2(string text)
{
//procedures
string letter = "A"; //Its not A its based on another method.
}
}
}
是的,但我的方法不能改變,以靜態的字符串它必須是靜態無效的,無論哪種方式,我不能在這一點上使用的返回值。 – Incognito
@Incognito:另一種方法是使用'out'參數,編輯我的答案。 –
非常感謝,這將做的工作就好了,雖然我的價值是3steps深,但我也跟着你的例子,你用恰當的方式了。 – Incognito