public IMessagePipeEnd ConnectHost(int pid) { if (Interlocked.CompareExchange(ref _hostEnd, new HostEnd(this), null) != null) { throw new InvalidOperationException(Resources.Exception_PipeHasHostEnd); } _pid = pid; return _hostEnd; }