帮忙做个题,创建一个委托,在请求用户输入时,使用他模拟Console.ReadLine()函数

fbhao442679385 2008-07-18 09:03:36
用C#做。
...全文
159 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
NANCHENBAI 2011-03-03
  • 打赏
  • 举报
回复
class Program
{
delegate string ReadLineDelegate();
static void Main(string[] args)
{
ReadLineDelegate ReadLine=new ReadLineDelegate(Console.ReadLine);
Console.WriteLine("Type a string:");
string an= ReadLine();
Console.WriteLine("You typed: {0}", an);
}
}
dohteryrx 2010-07-12
  • 打赏
  • 举报
回复
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice_delegate_1_4
{
class Program
{
delegate void STR1(string str);
delegate string STR2();
static string ReadLine()
{
string str = Console.ReadLine();
return str;
}
static void WriteLine(string str)
{
Console.WriteLine(str);
}
static void Main()
{
STR1 strings = new STR1(WriteLine);
STR2 stringss = new STR2(ReadLine);
string str = stringss();
strings (str);
Console.ReadKey();
}
}
}

16,717

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧