我想知道如果我能知道过了多久在在C#中的字符串
字节,谁知道?
I'm wondering if I can know how long in bytes for a string
in C#, anyone know?
您可以像使用ASCII编码使用,让每一个字节一个字符 System.Text.Encoding
类。
You can use encoding like ASCII to get a character per byte by using the System.Text.Encoding
class.
或尝试这种
System.Text.ASCIIEncoding.Unicode.GetByteCount(string);
System.Text.ASCIIEncoding.ASCII.GetByteCount(string);