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. iOS 状态栏隐藏显示

    在 info.plist 文件中 配置 View controller-based status bar appearance 对应的值为 NO 这样可以使用 application 对象来设置 状态 ...

  2. winform 多个label绑定一个事件

    1当多个label帮到到一个事件后 private void jiandao_Click(object sender, EventArgs e) { //sender显示的是窗体上接受事件的label ...

  3. python常用文件处理函数_1

    1.range()函数 函数原型:range(start,end,scan) 参数含义:start:计数从start开始.默认是从0开始的,如range()等价于range(0,5)  end:计数到 ...

  4. oracle RAC切换归档

    (转自leshami)    RAC环境下的归档模式切换与单实例稍有不同,主要是共享存储所产生的差异.在这种情况下,我们可以将RAC数据库切换到非集群状态下,仅仅在一个实例上来实施归档模式切换即可完成 ...

  5. java返回一个简单的日历

    import java.text.*; //首先得导包 import java.util.*; public class hw2 { /** * 计算日期差 返回的天数 * @param dstr1 ...

  6. Windows内核遍历驱动模块源码分析

    要获取windows 内核中所有驱动模块信息,调用 系统服务函数 NtQuerySystemInformation,参数SystemInformationClass 传入SystemModuleInf ...

  7. UITableView在设置contentOffset的同时也reload,造成tableView的contentOffset偏差

    最近在写一个聊天的框架,遇到一个奇葩的问题,就是发送聊天记录的时候(需要tableView上移,显示出最新的记录),增加一条记录无疑需要reload一下(大家都明白的),这是就会出现头疼的问题,页面显 ...

  8. DataTable.RowFilter 用法

    /// <summary> /// 处理DataRow筛选条件的特殊字符 /// </summary> /// <param name="rowFilter&q ...

  9. 互联网+下PDA移动智能手持POS超市收银开单软件

    是一套专为中小超市.专卖店设计的收银管理软件,广泛应用于中小超市(百货商店).化妆品店.婴幼儿用品店.玩具店.保健品店.茶叶店. 电器.文具图书.手机通讯器材店等行业的中小型店面店铺.该系统具有完善的 ...

  10. tomcat的debug模式启动不了

    这个问题可能是由于eclipse和tomcat的交互而产生的,在以debug模式启动tomcat时,发生了读取文件错误,eclipse自动设置了断点,导致tomcat不能正常启动.解决方法如下,打开b ...