您的位置:首页 > 编程语言 > C#

C#陈广自学视频笔记5

2015-03-26 15:02 232 查看
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace cg

{

class Method

{

//值参数的调用

public static void ValueMethod(int i)

{

i++;

}

//带引用参数的方法

public static void ReferenceMethod(ref int i)

{

i++;

}

//申明带输出参数的方法

public static void OutputMethod(out int i)

{

i = 0;

i++;

}

static void Main()

{

int i = 0;

int j = 0;

int k;

ValueMethod(i);

ReferenceMethod(ref j);

OutputMethod(out k);

// Console.WriteLine("i={0}",i);

Console.WriteLine("i="+i);

Console.WriteLine("j="+j);

Console.WriteLine("k=" + k);

Console.ReadKey();

}

}

}

在有些特定的时候值类型要进行装箱和拆箱操作

字符串也是引用类型

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: