In C#, out keyword 是argument传值变成passed by reference. out keyword 在同时返回多个值时很有用.

与ref keyword 相似. 若是使用out keyword传argument, 那么在method 的definition 和 使用时都需要家out keyword.

Async methods can't use out keyword.

Differences between out keyword and ref keyword:

ref requires that variable be initialized before it is passed.

 class OutReturnExample
{
static void Method(out int i, out string s1, out string s2)
{
i = ;
s1 = "I've been returned";
s2 = null;
}
static void Main()
{
int value;
string str1, str2;
Method(out value, out str1, out str2);
// value is now 44
// str1 is now "I've been returned"
// str2 is (still) null;
}
}

C# out Keyword的更多相关文章

  1. C#+无unsafe的非托管大数组(large unmanaged array in c# without 'unsafe' keyword)

    C#+无unsafe的非托管大数组(large unmanaged array in c# without 'unsafe' keyword) +BIT祝威+悄悄在此留下版了个权的信息说: C#申请一 ...

  2. senlin __init__() got an unexpected keyword argument 'additional_headers'

    从senlin源码重新编译更新了服务,然后执行 senlin的 cli就遇到了错误: __init__() got an unexpected keyword argument 'additional ...

  3. RobotFrameWork(五)控制流之if语句——Run Keyword If

    5.1 语句简介 robotframework中的if语句是使用关键字Run Keyword If来代替的 Run Keyword If 函数释义:如果给出的判断条件满足,就执行给出的关键字. 函数结 ...

  4. Robot Framework--06 用户关键字User Keyword

    转自:http://blog.csdn.net/tulituqi/article/details/7906130 在我们做自动化案例的时候,用的最多的主要是用户关键字.说到关键字,大体上可以分为测试库 ...

  5. [Javascript] The "this" keyword

    The very first thing to understand when we're talking about this-keyword is really understand what's ...

  6. [CareerCup] 13.5 Volatile Keyword 关键字volatile

    13.5 What is the significance of the keyword "volatile" in C 这道题考察我们对于关键字volatile的理解,顾名思义, ...

  7. Summary: Final Keyword

    In this tutorial we will learn the usage of final keyword. final keyword can be used along with vari ...

  8. C# Common Keyword

    [C# Common Keyword] 1.abstract Use the abstract modifier in a class declaration to indicate that a c ...

  9. 用keyword实现Editor.GetSelection的退出功能

    有时候我们在使用 GetSelection 功能让用户选择实体时,可能会给用户提供一些 keyword 选项,要接收用户选择的 keyword 选项,需要用到 PromptSelectionOptio ...

随机推荐

  1. 微信开发之Author网页授权

     微信开发中,经常有这样的需求:获得用户头像.绑定微信号给用户发信息.. 那么实现这些的前提就是授权!   1.配置安全回调域名: 在微信公众号请求用户网页授权之前,开发者需要先到公众平台官网中的&q ...

  2. sqlserver数据以及日志文件的设置小结

    1.1:增加次数据文件 从SQL SERVER 2005开始,数据库不默认生成NDF数据文件,一般情况下有一个主数据文件(MDF)就够了,但是有些大型的数据库,由于信息很多,而且查询频繁,所以为了提高 ...

  3. 数据库错误:check the manual that corresponds to your MySQL server version for the right sy

    检查对应到您的MySQL服务器版本附近使用正确的语法手册 数据库插入的时候出现上述问题,总结了两方面原因: 1.语法错误,这是百度之得到的大部分结果,但是没有解决我的问题 2.仔细观察我的sql语句, ...

  4. Microchip微芯HCS301解密HCS360解密HCS361芯片解密多少钱?

    Microchip微芯HCS系列芯片解密型号: HCS101 | HCS200 | HCS201 | HCS201T | HCS300 | HCS300T HCS301 | HCS301T | HCS ...

  5. iOS 开发技巧收藏贴 链接整理

    54个技巧 57个技巧 正则表达式

  6. Python for Infomatics 第12章 网络编程三(译)

    注:文章原文为Dr. Charles Severance 的 <Python for Informatics>.文中代码用3.4版改写,并在本机测试通过. 12.5 HTML分析和网页抓取 ...

  7. Spark RDD 多文件输入

    1.将多个文本文件读入一个RDD中 SparkConf conf=new SparkConf() .setMaster("local") .setAppName("sav ...

  8. 【Spring RCP】 RULES规则

    Rich Client 约束规则 1.Constraint 定义了一个约束接口,接口中只有1个方法 public boolean test(Object argument); //这个方法指对约束的检 ...

  9. ZK listbox 两种分页使用及比较

    参考:http://tsinglongwu.iteye.com/blog/849923 以下代码模拟数据量大时情况,采用“<paging>”组件方式 前台Listbox.zul : < ...

  10. javascript学习之运动框架

    模仿新浪博客首页的,最新评论: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"&g ...