program.cs

来自「嵌入式开发从基础到提高」· CS 代码 · 共 34 行

CS
34
字号
using System;
using System.Collections.Generic;
using System.Text;

namespace 参数的引用传递
{
/************************
* 程序描述:测试引用传递实际参数和形式参数变化的关系
* 创 建 人:ncbcy@eiTarget
* 版 本 号:1.0.0
* 修改记录:0
***********************/
    class Program
    {
        static void Main(string[] args)
        {
            int intMain = 10;
            Console.WriteLine("在引用传递给形式参数以前的值为:" + intMain);
            refcd.cdm(ref intMain);
            Console.WriteLine("在引用传递给形式参数之后的值为:" + intMain);
            Console.ReadLine();
        }
    }
    class refcd
    {
        static public void cdm(ref int intcdm)
        {
            intcdm += 10;
            Console.WriteLine("形式参数接受了值,这个值被加了10,值为:" + intcdm);
        }
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?