使用string类的length属性,可以得到字符串的长度
String.Length来获取字符串长度
String.Length;
这看你想计算啥长度了字符长度直接访问Length字节长度则使用System.Text.Encoding.GetEncoding("GB2312").GetByteCount(str)