zoukankan      html  css  js  c++  java
  • 【.Net】 C#参数数组与函数重载

            static int ParamsFunc(int i, string s)
            {
                return i;
            }
            static int ParamsFunc(int i, string s, params int[] ints)
            {
                return ints.Length;
            }
            static void Main(string[] args)
            {
                int[] ints = { 0, 1, 2, 3, 5 };
                Console.Write(ParamsFunc(1, "0").ToString());
                Console.ReadKey();
            }

    以上代码,调用哪个重载函数?--上

            static int ParamsFunc(int i, string s, params int[] ints)
            {
                return ints.Length;
            }
            static void Main(string[] args)
            {
                int[] ints = { 0, 1, 2, 3, 5 };
                Console.Write(ParamsFunc(1, "0").ToString());
                Console.ReadKey();
            }

    以上代码呢?

    params可以是不接受参数,但是如果有重载函数,则不同了。

  • 相关阅读:
    IfcAxis2Placement3D
    IfcAxis2Placement2D
    IfcAxis1Placement
    realsense 深度数据
    realsense 深度数据
    realsense 深度数据
    sudo fdisk -l
    temviewer历史版本
    100/9801
    IfcPlacement
  • 原文地址:https://www.cnblogs.com/TonyZhao/p/3486884.html
Copyright © 2011-2022 走看看