由code设置默认的调试命令行参数? [英] Setting default debug commandline arguments by code?
本文介绍了由code设置默认的调试命令行参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一种方法来设置默认的调试命令行参数或默认应用程序参数没有设置的参数中的项目设置调试选项卡?
我的意思是,如果我可以做这样的事情:
模块主要
#如果DEBUG然后,
我的应用程序的调试命令行参数:
My.Application.CommandLineArgs = - 睡眠5 -interval 50 -Key CTRL + C
#END如果
...子的main()
GetArguments()函数获取至极,我已经设置arguemnts。
...等等...
前端模块
解决方案
您可以创建一个类,将抽象的其他code命令行。为了调试编译它将返回固定的字符串,否则将返回真正的Enviroment.CommandLine。
公共静态类CommandLineHelper
{
公共静态字符串GetCommandLine()
{
#如果调试
回到我的命令行字符串;
#其他
返回Enviroment.CommandLine;
#ENDIF
}
}
There is a way to set the default debug commandline arguments or the default application arguments without setting the arguments in the Debug tab of the project settings?
I'll mean if I can do something like this:
Module Main
#If DEBUG Then
' Debug Commandline arguments for my application:
My.Application.CommandLineArgs = "-Sleep 5 -Interval 50 -Key CTRL+C"
#End If
...Sub main()
GetArguments() ' A function wich gets the arguemnts that I've set.
...etc...
End module
解决方案
You can create a class that will abstract your other code from command line. For debug compilation it will return fixed string, otherwise it will return real Enviroment.CommandLine.
public static class CommandLineHelper
{
public static string GetCommandLine()
{
#if DEBUG
return "my command line string";
#else
return Enviroment.CommandLine;
#endif
}
}
这篇关于由code设置默认的调试命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文