System.Net.WebSockets.WebSocketBuffer.IsInternalBuffer C# (CSharp) Method

IsInternalBuffer() private method

private IsInternalBuffer ( byte buffer, int offset, int count ) : bool
buffer byte
offset int
count int
return bool
        internal bool IsInternalBuffer(byte[] buffer, int offset, int count)
        {
            Debug.Assert(buffer != null, "'buffer' MUST NOT be NULL.");
            Debug.Assert(_nativeBuffer.Array != null, "'m_NativeBuffer.Array' MUST NOT be NULL.");
            Debug.Assert(offset >= 0, "'offset' MUST NOT be negative.");
            Debug.Assert(count >= 0, "'count' MUST NOT be negative.");
            Debug.Assert(offset + count <= buffer.Length, "'offset + count' MUST NOT exceed 'buffer.Length'.");

            return object.ReferenceEquals(buffer, _nativeBuffer.Array) &&
                offset >= _nativeBuffer.Offset &&
                offset + count <= _nativeBuffer.Offset + _nativeBuffer.Count;
        }