如何从静态main()调用方法? [英] How do you call a method from static main()?
本文介绍了如何从静态main()调用方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有 Main
方法和功能的控制台应用程序.
I have a console application with a Main
method and a function.
如何从 Main
方法进行函数调用?
How can I make a function call from the Main
method?
我知道下面的代码不起作用
I know the code below won't work
static void Main(string[] args)
{
string btchid = GetCommandLine();// GetCommandline is a mthod which returns a string
}
推荐答案
还有
var p = new Program();
string btchid = p.GetCommandLine();
这篇关于如何从静态main()调用方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文