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();
}
}
}
在有些特定的时候值类型要进行装箱和拆箱操作
字符串也是引用类型
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();
}
}
}
在有些特定的时候值类型要进行装箱和拆箱操作
字符串也是引用类型
相关文章推荐
- C#陈广自学视频笔记2——Array和ArrayList的区别
- C#陈广自学视频笔记4——方法(Method)
- C#陈广自学视频笔记3——namespace
- C#陈广自学视频笔记1
- C#视频(陈广版)学习笔记21
- C#视频(陈广版)学习笔记24
- C#自学快速入门经典笔记心得
- 陈广 C#学习笔记(数组2-3)
- 看陈广老师c#参考视频总结(第九篇)
- 看陈广老师c#参考视频总结(第十篇 完)
- 看陈广老师c#参考视频总结(第五篇)
- 看陈广老师c#参考视频总结(第四篇)
- c#window程序开发入门系列--自学笔记
- c#window程序开发入门系列--自学笔记之WebBrowser
- C#之消息队列的简要说明----自学笔记
- 黑马程序员----C#基础自学笔记
- 黑马程序员----C#面向对象自学笔记
- 看陈广老师c#参考视频总结(第八篇)
- 看陈广老师c#参考视频总结(第三篇)
- 陈广老师 C#语言参考视频打包下载地址