如何获取Form程序的args?在控制台应用程序中,我可以使用 args[]
但是 Form Application 呢?
最佳答案
一个简单的方法:
string[] args = Environment.GetCommandLineArgs();
或者,您可以更改 Main-call 以包含参数(在 Program.cs 中):
static void Main(string[] args)
{
然后您需要将它传递到您的表单中,并相应地更改表单的构造函数(假设这是您需要 args
的地方):
public Form1(string[] args)
{
关于c# - 如何获取 Form 程序的参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4780171/