System.Data.SqlClient.TdsParser.WriteCharArray C# (CSharp) Method

WriteCharArray() private method

private WriteCharArray ( char carr, int length, int offset, System.Data.SqlClient.TdsParserStateObject stateObj, bool canAccumulate = true ) : System.Threading.Task
carr char
length int
offset int
stateObj System.Data.SqlClient.TdsParserStateObject
canAccumulate bool
return System.Threading.Task
        internal Task WriteCharArray(char[] carr, int length, int offset, TdsParserStateObject stateObj, bool canAccumulate = true)
        {
            int cBytes = ADP.CharSize * length;

            // Perf shortcut: If it fits, write directly to the outBuff
            if (cBytes < (stateObj._outBuff.Length - stateObj._outBytesUsed))
            {
                CopyCharsToBytes(carr, offset, stateObj._outBuff, stateObj._outBytesUsed, length);
                stateObj._outBytesUsed += cBytes;
                return null;
            }
            else
            {
                if (stateObj._bTmp == null || stateObj._bTmp.Length < cBytes)
                {
                    stateObj._bTmp = new byte[cBytes];
                }

                CopyCharsToBytes(carr, offset, stateObj._bTmp, 0, length);
                return stateObj.WriteByteArray(stateObj._bTmp, cBytes, 0, canAccumulate);
            }
        }
TdsParser