Click or drag to resize
EncodingGetBytes Method (Char, Int32, Byte, Int32)
When overridden in a derived class, encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual int GetBytes(
	char* chars,
	int charCount,
	byte* bytes,
	int byteCount
)

Parameters

chars
Type: SystemChar*
A pointer to the first character to encode.
charCount
Type: SystemInt32
The number of characters to encode.
bytes
Type: SystemByte*
A pointer to the location at which to start writing the resulting sequence of bytes.
byteCount
Type: SystemInt32
The maximum number of bytes to write.

Return Value

Type: Int32
The actual number of bytes written at the location indicated by the bytes parameter.
Exceptions
ExceptionCondition
ArgumentNullExceptionchars is null.-or- bytes is null.
ArgumentOutOfRangeExceptioncharCount or byteCount is less than zero.
ArgumentExceptionbyteCount is less than the resulting number of bytes.
EncoderFallbackExceptionA fallback occurred (see Character Encoding in the .NET Framework for complete explanation)-and-EncoderFallback is set to EncoderExceptionFallback.
See Also