CSharp examples for System:Byte
Counts how many bytes the string will use, including the null terminator. Uses UTF8 encoding.
using System.Text; using System.Collections.Generic; using System;//from w w w. j a v a2 s . c o m public class Main{ /// <summary> /// Counts how many bytes the string will use, including the null terminator. Uses UTF8 encoding. /// </summary> /// <param name="value"></param> /// <returns></returns> public static int GetByteCountUtf8(string value) { return Encoding.UTF8.GetByteCount(value); } }