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.

  • 相关阅读:
    初识数据库
    局域网和广域网
    面试题汇总
    SSO单点登录解决方案
    接口加密问题
    幂等性问题
    消息队列的消费失败、重复消费问题
    Redis集群搭建
    HashCode详解
    HashMap的底层原理
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5147964.html
Copyright © 2011-2022 走看看