首页 > Windows开发 > 详细

C#的引用类型

时间:2015-12-12 01:32:25      阅读:231      评论:0      收藏:0      [点我收藏+]

1,  在内存的栈上面存储引用,在堆上存值

2,  object、string、dynamic。

3,  object 是所有类的基类,所以,所有的类都具有object的方法。

4,  string用来表示字符串。

 1 using System;
 2 
 3 namespace 实验
 4 {
 5     class Program
 6     {
 7         static void Main(string[] args)
 8         {
 9             object o = new object();
10             Console.WriteLine(o.GetType());
11             Console.WriteLine(o.ToString());
12 
13             string s = "hellow";
14             Console.WriteLine(s.ToString());
15             s += " world";
16             Console.WriteLine(s.ToString());
17 
18             string noat = "c:\\asd\\fgh";
19             Console.WriteLine(noat.ToString());
20 
21             string at = @"c:\asd\fgh";
22             Console.WriteLine(at.ToString());
23 
24             Console.ReadLine();
25         }
26     }
27 }

 技术分享

C#的引用类型

原文:http://www.cnblogs.com/longjiayu/p/5040576.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!