2009年12月27日 星期日

[c#] 由函式反向傳遞直給飲用者 應用介紹-[public void mystr(out string x)]

由函式反向傳遞值給引用者 應用介紹-[public void mystr(out string x)]

//函式引用者取值
private void button1_Click(object sender, EventArgs e)
{
string x;
mystr(out x);
textBox1.Text = x;
}

//反向送出函式
public void mystr(out string x)
{
x = "read";
Console.WriteLine(x);
}

沒有留言:

張貼留言