C#字符串默认值

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

【C#字符串默认值】
转载于:https://www.cnblogs.com/timeObjserver/p/6115575.html

    推荐阅读