JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

c# out

发布时间 2023-12-18 17:23:43作者: 四月柳巷
在方法中一般的return只能返回1个参数,当需要返回多个参数时就可以用out
static void Main(string[] args)
{
int n;
bool b = MyTryParse("123", out n);
Console.WriteLine(b);
Console.WriteLine(n);
Console.ReadKey();
}
 
public static bool MyTryParse(string s, out int result)
{
result = 0;
try
{
result = Convert.ToInt32(s);
return true;
}
catch
{
return false;
}
}

 

    本栏目推荐文章
  • C# 方法中的 引用参数 ref out 的使用
  • 服务器清理TomCat 的catalina.out文件
  • Nginx错误:attempt to set status 403 via ngx.exit after sending out the response status 200
  • Kafka消费端抛出异常Offset commit cannot be completed since the consumer is not part of an active group for auto partition assignment; it is likely that the consumer was kicked out of the group的解决方案
  • ZIMP - Unit test timed out because of mock
  • xshell连接显示timed out waiting for input: auto-logout
  • Floyd判联通(传递闭包) & poj1049 sorting it all out
  • 初中英语优秀范文100篇-036Eating out or Dining at Home-出去吃还是在家吃
  • docker 启动报错 library initialization failed - unable to allocate file descriptor table - out of memory
  • intellij idea常用快捷键快速生成main方法、for循环、out输出
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们