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);
}
}