Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh date, add System.CommandLine #40004

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Main() and command-line arguments"
description: Learn about Main() and command-line arguments. The 'Main' method is the entry point of an executable program.
ms.date: 05/14/2021
ms.date: 03/14/2024
f1_keywords:
- "main_CSharpKeyword"
- "Main"
Expand Down Expand Up @@ -189,6 +189,9 @@ long num = Convert.ToInt64(s);

For more information, see <xref:System.Int64.Parse%2A> and <xref:System.Convert>.

> [!TIP]
> Parsing command-line arguments can be complex. Consider using the [System.CommandLine](/dotnet/standard/commandline/) library (currently in beta) to simplify the process.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the size of the upcoming breaking changes (dotnet/command-line-api#2338), I'd rather call it alpha.


The following example shows how to use command-line arguments in a console application. The application takes one argument at run time, converts the argument to an integer, and calculates the factorial of the number. If no arguments are supplied, the application issues a message that explains the correct usage of the program.

To compile and run the application from a command prompt, follow these steps:
Expand Down
Loading