码迷,mamicode.com
首页 > Windows程序 > 详细

C#字符串默认值

时间:2016-11-30 03:25:13      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:ati   code   nbsp   默认   字符   static   ring   异常   bsp   

 1 using System;
 2 class MYTestX
 3 {
 4     class CT
 5     {
 6     }
 7     class CO
 8     {
 9         public CT ott;  //默认是null
10         public string strx;//默认也是null,而不是空串""
11         public virtual void Test()
12         {
13             Console.WriteLine("co-testJ");
14         }
15     }
16     static void Main(string[] args)
17     {
18         CO oo = new CO();
19         CO ot = null;
20 
21         Console.WriteLine(oo.strx + "ttt");
22         Console.WriteLine(null + "ttt"); //null可以与字符串连接,不会出现异常
23     }
24 }

 

C#字符串默认值

标签:ati   code   nbsp   默认   字符   static   ring   异常   bsp   

原文地址:http://www.cnblogs.com/timeObjserver/p/6115575.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!