System.Data.SqlClient.TdsParser.TdsOutputStream.WriteAsync C# (CSharp) Method

WriteAsync() public method

public WriteAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task
buffer byte
offset int
count int
cancellationToken CancellationToken
return Task
            public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
            {
                Debug.Assert(_parser._asyncWrite);
                ValidateWriteParameters(buffer, offset, count);

                StripPreamble(buffer, ref offset, ref count);

                Task task = null;
                if (count > 0)
                {
                    _parser.WriteInt(count, _stateObj); // write length of chunk
                    task = _stateObj.WriteByteArray(buffer, count, offset, canAccumulate: false);
                }
                if (task == null)
                {
                    return CompletedTask;
                }
                else
                {
                    return task;
                }
            }