System.Net.WebSockets.WebSocketBase.WebSocketOperation.SendOperation.Initialize C# (CSharp) Method

Initialize() protected method

protected Initialize ( Nullable buffer, CancellationToken cancellationToken ) : void
buffer Nullable
cancellationToken System.Threading.CancellationToken
return void
                protected override void Initialize(Nullable<ArraySegment<byte>> buffer,
                    CancellationToken cancellationToken)
                {
                    Debug.Assert(!_BufferHasBeenPinned, "'_BufferHasBeenPinned' MUST NOT be pinned at this point.");
                    _webSocket.ThrowIfDisposed();
                    _webSocket.ThrowIfPendingException();

                    Nullable<Interop.WebSocket.Buffer> payloadBuffer = CreateBuffer(buffer);
                    if (payloadBuffer != null)
                    {
                        WebSocketProtocolComponent.WebSocketSend(_webSocket, BufferType, payloadBuffer.Value);
                    }
                    else
                    {
                        WebSocketProtocolComponent.WebSocketSendWithoutBody(_webSocket, BufferType);
                    }
                }