开发者

How to perceive in code if developer pressed F5 or Ctrl-F5

How can I perceive in code (C#) if developer pressed F5 or Ctrl-F5 prio开发者_开发百科r to execute solution in VS2010?

if (F5Pressed) {do something} else {do some other thing}


static void Main(string[] args)
{

    if (System.Diagnostics.Debugger.IsAttached)
       Console.WriteLine("f5");
     else
       Console.WriteLine("ctrl f5");
    string s = Console.ReadLine();

}

This works in the general case, but is not exactly what you asked for. As other debuggers could be attached, also if you just run the exe by double clicking it will report that crtl f5 was pressed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜