using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication12
{
    class Program
    //创建一个委托,在请求用户输入时,使用它模拟Console.ReadLine()函数并输出
    {
        //声明委托
        delegate void ProcessDelegate1(string param);
        delegate string ProcessDelegate2();
        //获得输入的函数
        static string getInput()
        {
            string str = Console.ReadLine();
            return str;
        }
        //输出函数
        static void getOutput(string param)
        {
            Console.WriteLine(param);
        }
        static void Main(string[] args)
        {
            //声明2委托变量
            ProcessDelegate1 process1;
            ProcessDelegate2 process2;
            process1 = new ProcessDelegate1(getOutput);
            process2 = new ProcessDelegate2(getInput);
            string str = process2();//输入
            process1(str);//输出
            Console.ReadKey();
        }
    }
}

 
											





