public string test(int sql, string tb, string td){ return ……},如何将这三个值返回调用处?谢谢。

wtoeb 2004-07-08 03:26:51
public string test(int sql, string tb, string td)
{
return ……
}
如何将这三个值返回调用处?即是return后面怎么写?
谢谢。
...全文
189 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
happyjun2000 2004-07-09
  • 打赏
  • 举报
回复
方法一
public void test(ref int a, ref string b, ref string c)
方法二
public string test(out int sql,out string tb, out string td)
方法三
struct threeValue
{
int sql;
string tb;
string td;
}
public threeValue test(threeValue value)
{
value.sql=1;
value.tb="1";
value.td="1";
return value;
}
jxhql 2004-07-09
  • 打赏
  • 举报
回复
public void test(ref int a, ref string b, ref string c)
melonlee 2004-07-08
  • 打赏
  • 举报
回复
public void test(ref int a, ref string b, ref string c)
{
a=1;
b=2;
c=3;
}
调用
int a,b,c
a=0;
b=0;
c=0;
test(1,2,3)
//result a=1,b=2,c=3
lxcc 2004-07-08
  • 打赏
  • 举报
回复
private void Button2_Click(object sender, System.EventArgs e)
{
int ii=0;
string ss="";
double dd=0;
Test(ref ii,ref ss, ref dd);

Response.Write(ii.ToString()+"<br>");
Response.Write(ss+"<br>");
Response.Write(dd.ToString()+"<br>");
}

private void Test(ref int i,ref string s ,ref double d)
{
i=1;
s="2";
d=3.00;
}
lxcc 2004-07-08
  • 打赏
  • 举报
回复
public void test(ref int sql, ref string tb, ref string td)
sharpblade 2004-07-08
  • 打赏
  • 举报
回复
public string test()
返回一個字符串
你這樣一個函數return不行
chenyuming2004 2004-07-08
  • 打赏
  • 举报
回复
把函数声明改成下面
public string test(out int sql,out string tb, out string td)
{
}


这样调用
test(out 5,out "666",out "sdlksd");

去查查out的意思吧。
小贵子88 2004-07-08
  • 打赏
  • 举报
回复
leettt(等着瞧) 说的不错了
public string test(out int sql,out string tb, out string td)
{
//记得返回前一定要对对sql/tb/td赋值
}

调用
int a;
string b,c;
string s=test(out a,out b,out c);
wtoeb 2004-07-08
  • 打赏
  • 举报
回复
能不能详细些嘛,各位!!!
云孤天 2004-07-08
  • 打赏
  • 举报
回复
用ref声明参数
wtoeb 2004-07-08
  • 打赏
  • 举报
回复
private void Page_Load(object sender, System.EventArgs e)
{
int a;
int b;
int c;
id=1;
test(a,b,c);
}
public string test(int a, int b, int c)
{
a=a*2;
b=b*a;
c=c*b;
return …… //即是如何返回a,b,c这三个值?
}
leettt 2004-07-08
  • 打赏
  • 举报
回复
public string test(out int sql,out string tb, out string td)
{
}
chinawn 2004-07-08
  • 打赏
  • 举报
回复
想返回什么就返回
cjzlxy 2004-07-08
  • 打赏
  • 举报
回复
不大明白楼主的意思???

111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧