根据 MSDN,main()
的返回值只能是 void
或 int
:https://msdn.microsoft.com/en-us/library/0fwzzxz2.aspx .
根据我正在尝试的编程挑战,
This document specifies the intended operation of the csLogic.exe program
csLogic [equation] [parameter1] [parameter2] [parameter3] ...
example usage: csLogic.exe ~1^(2~&3) 0x3FFE 0x2FCE 0xFCC1
Returns the value: 4926 (0x133E)
[...]
Parameters are up to 64 bit values
[...]
有没有办法让我的 main()
返回 64 位值?或者有解决办法吗?
最佳答案
不,但这不是 C# 限制而是 WinAPI limitation , 一个进程的退出代码只能是一个 32 位数字,无论它是用什么语言编写的。
作为“绕过它的方法”,我们需要您的要求的更多详细信息,您的挑战是否需要您使用程序的返回码?您可以将结果输出到 Console.Write(
或输出文件吗?
关于c# - 是否有任何 "hacks"能够从 main() 返回一个 long?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33273542/