System.Text.EncoderNLS.Convert C# (CSharp) Method

Convert() private method

private Convert ( char chars, int charCount, byte bytes, int byteCount, bool flush, int &charsUsed, int &bytesUsed, bool &completed ) : void
chars char
charCount int
bytes byte
byteCount int
flush bool
charsUsed int
bytesUsed int
completed bool
return void
        public unsafe override void Convert(char* chars, int charCount,
                                              byte* bytes, int byteCount, bool flush,
                                              out int charsUsed, out int bytesUsed, out bool completed)
        {
            // Validate input parameters
            if (bytes == null || chars == null)
                throw new ArgumentNullException(bytes == null ? nameof(bytes): nameof(chars), SR.ArgumentNull_Array);

            if (charCount < 0 || byteCount < 0)
                throw new ArgumentOutOfRangeException((charCount < 0 ? nameof(charCount): nameof(byteCount)), SR.ArgumentOutOfRange_NeedNonNegNum);
            Contract.EndContractBlock();

            // We don't want to throw
            m_mustFlush = flush;
            m_throwOnOverflow = false;
            m_charsUsed = 0;

            // Do conversion
            bytesUsed = m_encoding.GetBytes(chars, charCount, bytes, byteCount, this);
            charsUsed = m_charsUsed;

            // Its completed if they've used what they wanted AND if they didn't want flush or if we are flushed
            completed = (charsUsed == charCount) && (!flush || !HasState) &&
                (m_fallbackBuffer == null || m_fallbackBuffer.Remaining == 0);
            // Our data thingies are now full, we can return
        }

Same methods

EncoderNLS::Convert ( char chars, int charIndex, int charCount, byte bytes, int byteIndex, int byteCount, bool flush, int &charsUsed, int &bytesUsed, bool &completed ) : void