zoukankan      html  css  js  c++  java
  • C# Study

    An output parameter is used for output parameter passing, an output parameter is similar to a reference parameter except that the initial value of the caller-provided argument is unimportant. an output parameter is declared with the out modifier.

    Static and instance methods

    • A static method does not operate on a specific instance and can only directly access static members.
    • An instance method operaten a specific instance and can access both static and instance members

    A parameter array

    • Permits a variable number of arguments to be passed to a method. A parameter array is declared with the params modifier. Only the last parameter of a method can be a parameter array, and the type of a parameter array must be a single-dimensional array type. The Write and WriteLine methods of the System.Console class are good examples of parameter array usage. They are declared as follows.

      public class Console
      {
      public static void Write(string fmt, params object[] args) {...}

      public static void WriteLine(string fmt, params object[] args) {...}

      ...
      }

      Within a method that uses a parameter array, the parameter array behaves exactly like a regular parameter of an array type. However, in an invocation of a method with a parameter array, it is possible to pass either a single argument of the parameter array type or any number of arguments of the element type of the parameter array. In the latter case, an array instance is automatically created and initialized with the given arguments. This example

      Console.WriteLine("x={0} y={1} z={2}", x, y, z);

      is equivalent to writing the following.

      string s = "x={0} y={1} z={2}";
      object[] args = new object[3];
      args[0] = x;
      args[1] = y;
      args[2] = z;
      Console.WriteLine(s, args);

  • 相关阅读:
    数论学习笔记之欧拉函数
    [CQOI2014]危桥
    lspci -nnk
    linux 详解useradd 命令基本用法
    。 (有些情况下通过 lsof(8) 或 fuser(1) 可以 找到有关使用该设备的进程的有用信息)
    CentOS 7 设置默认进入字符界面
    下面附上top和sar的使用方法,方便参考! "top"工具
    Centos7/RHEL7 开启kdump
    Linux内存带宽的一些测试笔记
    调试测试
  • 原文地址:https://www.cnblogs.com/flyinthesky/p/1563481.html
Copyright © 2011-2022 走看看