zoukankan      html  css  js  c++  java
  • C#

    The ref keyword causes an argument to be passed by reference, not by value. The effect of passing by reference is that any change to the parameter in the called method is reflected in the calling method. For example, if the caller passes a local variable expression or an array element access expression, and the called method replaces the object to which the ref parameter refers, then the caller’s local variable or the array element now refer to the new object.

    Note: Do not confuse the concept of passing by reference with the concept of reference types. The two concepts are not the same. A method parameter can be modified byref regardless of whether it is a value type or a reference type. There is no boxing of a value type when it is passed by reference.

    To use a ref parameter, both the method definition and the calling method must explicitly use theref keyword. An argument that is passed to a ref parameter must be initialized before it is passed.

  • 相关阅读:
    1112评论
    1029 C语言文法
    0909编译原理理解和解释
    复利计算4.0-单元测试
    命令解析程序的编写
    《构建之法》1、2、3章思考与感想
    复利计算4.0
    实验三的分析与总结
    复利计算(更新)
    单、复利计算程序
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5147964.html
Copyright © 2011-2022 走看看