C#字符串默认值

 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 }
原文地址:https://www.cnblogs.com/timeObjserver/p/6115575.html