C# 基础入门 互动版

属性


  string类有一个属性Length Length在当前的 String 对象中获取字符数。

string s="hello world!";
Console.WriteLine(s.Length);

运行结果为:12。