Note: This method is new in the .NET Framework version 2.0.
When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.
This method is not CLS-compliant. Namespace: System.Text Assembly: mscorlib (in mscorlib.dll)
To calculate the exact array size that GetBytes requires to store the resulting bytes, use GetByteCount. To calculate the maximum array size, use GetMaxByteCount. The GetByteCount method generally allows you to allocate less memory, whereas the GetMaxByteCount method generally executes faster.