How to pass command line arguments in Visual Studio 2022?

How to pass command line arguments in Visual Studio 2022?

Right-click Projects -> Properties 

In the window select Debug -> General -> Open debug launch profiles UI



How to access the command line variables when top-level statements is used?

Console.WriteLine("Hello, World!");

foreach(var s in args)
{
    Console.Write($"{s}, ");   
}

For more information about top-level statements follow this url:

https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/top-level-statements









Comments

Popular posts from this blog

To read

Connect to Sql Database and get data C#

LINQ (Where, Min, Max, Average)