gpt4 book ai didi

c# - 如何从静态 main() 调用方法?

转载 作者:可可西里 更新时间:2023-11-01 08:31:40 25 4
gpt4 key购买 nike

我有一个带有 Main 方法和函数的控制台应用程序。

如何从 Main 方法调用函数?

我知道下面的代码行不通

static void Main(string[] args)
{
string btchid = GetCommandLine();// GetCommandline is a mthod which returns a string
}

最佳答案

还有

var p = new Program();
string btchid = p.GetCommandLine();

关于c# - 如何从静态 main() 调用方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5728494/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com