游戏开发论坛

 找回密码
 立即注册
搜索
查看: 7417|回复: 4

C# Console Project如何按下任意???

[复制链接]

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
发表于 2007-9-18 22:40:00 | 显示全部楼层 |阅读模式
C# Console Project如何按下任意???
我希望程序在最後的?r候,可以按下任意???
???要用什?函式?

using System;
// Declare delegate -- defines required signature:
delegate void SampleDelegate(string message);

class MainClass
{
    // Regular method that matches signature:
    static void SampleDelegateMethod(string message)
    {
     Console.WriteLine(message);
    }

    static void Main()
    {
     // Instantiate delegate with named method:
     SampleDelegate d1 = SampleDelegateMethod;
     // Instantiate delegate with anonymous method:
     SampleDelegate d2 = delegate(string message)
     {
     Console.WriteLine(message);
     };

     // Invoke delegate d1:
     d1("Hello");
     // Invoke delegate d2:
     d2(" World");

    }
}

1

主题

29

帖子

29

积分

注册会员

Rank: 2

积分
29
发表于 2007-9-19 14:09:00 | 显示全部楼层

Re:C# Console Project如何按下任意???

            Console.WriteLine(&quotress any key to continue!");
            Console.ReadKey();

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
 楼主| 发表于 2007-9-19 19:22:00 | 显示全部楼层

Re:C# Console Project如何按下任意???

多?

76

主题

1100

帖子

1107

积分

金牌会员

Rank: 6Rank: 6

积分
1107
发表于 2007-9-20 18:48:00 | 显示全部楼层

Re:C# Console Project如何按下任意???

  Console.ReadKey();

0

主题

1

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2008-1-6 13:38:00 | 显示全部楼层

Re: C# Console Project如何按下任意???

为什么我在控制台上加了这段代码后,显示出按任意键继续,但是我按任意键后没有出现想要的结果,只使在屏幕上出现我按键的字母。 [em1] [em3]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-23 22:37

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表