BaseEncodingGetBytes Method (Char, Int32, Int32, Byte, Int32) | CryptSharp |
When overridden in a derived class, encodes a set of characters from the specified character array into the specified byte array.
Namespace: CryptSharp.Utility
Assembly: CryptSharp (in CryptSharp.dll) Version: 2.1.0.0
Syntax
public override int GetBytes( char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex )
Public Overrides Function GetBytes ( chars As Char(), charIndex As Integer, charCount As Integer, bytes As Byte(), byteIndex As Integer ) As Integer
public: virtual int GetBytes( array<wchar_t>^ chars, int charIndex, int charCount, array<unsigned char>^ bytes, int byteIndex ) override
abstract GetBytes : chars : char[] * charIndex : int * charCount : int * bytes : byte[] * byteIndex : int -> int override GetBytes : chars : char[] * charIndex : int * charCount : int * bytes : byte[] * byteIndex : int -> int
Parameters
- chars
- Type: SystemChar
The character array containing the set of characters to encode. - charIndex
- Type: SystemInt32
The index of the first character to encode. - charCount
- Type: SystemInt32
The number of characters to encode. - bytes
- Type: SystemByte
The byte array to contain the resulting sequence of bytes. - byteIndex
- Type: SystemInt32
The index at which to start writing the resulting sequence of bytes.
Return Value
Type: Int32The actual number of bytes written into bytes.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | chars is null.-or- bytes is null. |
ArgumentOutOfRangeException | charIndex or charCount or byteIndex is less than zero.-or- charIndex and charCount do not denote a valid range in chars.-or- byteIndex is not a valid index in bytes. |
ArgumentException | bytes does not have enough capacity from byteIndex to the end of the array to accommodate the resulting bytes. |
EncoderFallbackException | A fallback occurred (see Understanding Encodings for complete explanation)-and-EncoderFallback is set to EncoderExceptionFallback. |
See Also