现在的位置: 首页 > 综合 > 正文

.net中的函数可以返回多个值了

2012年01月19日 ⁄ 综合 ⁄ 共 278字 ⁄ 字号 评论关闭

通过out关键字
private string TestOut(out char i)

{

i = 'a';
return “good study“;
}
private void button_Click(object sender,System.EventArgs e)

{
char i;//不必初始化
string getReturn = TestOut(out i);
richTextBox1.AppendText(“方法执行的返回值是:“+getReturn+“\r\n“);
richTextBox1.AppendText(“返回out参数的值是:“+i.ToString()+“\r\n“);

}

抱歉!评论已关闭.