gpt4 book ai didi

c# - 如何在 visual studio for mac 中将参数传递给 Main() C#

转载 作者:太空狗 更新时间:2023-10-29 20:15:56 25 4
gpt4 key购买 nike

我查看了其他版本的 visual studio 的不同资源,但我不清楚如何在此处使用 arg 调用 Main

using System;

namespace helloWorld
{
class MainClass
{
public static void Main(string[] args)
{
if (args.Length > 0)
{
Console.WriteLine("Hello " + args[0]);
}
else
{
Console.WriteLine("Hello World!");
}
}
}
}

最佳答案

可以在 Visual Studio for Mac 中为您的应用程序提供参数,方法是右键单击右侧 Pane 中的控制台应用程序,然后转到 Options > Run > Configurations > Default 您将在其中看到 Arguments 文本字段。

enter image description here

关于c# - 如何在 visual studio for mac 中将参数传递给 Main() C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41775512/

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