Exemplo n.º 1
0
        /// <summary>
        /// 发送一行
        /// </summary>
        /// <param name="name"></param>
        /// <param name="content"></param>
        /// <param name="encoding"></param>
        /// <returns></returns>
        public static string SendLine(string name, string content, Encoding encoding)
        {
            using (NamedPipeClientStream stream = new NamedPipeClientStream(".", name, PipeDirection.InOut))
            {
                stream.Connect();

                stream.WriteLine(content, encoding);

                return(stream.ReadLine(encoding));
            }
        }