Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8582915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:24:50+00:00 2026-06-11T21:24:50+00:00

How exactly is string[] args populated in a C# Main method? For instance, is

  • 0

How exactly is string[] args populated in a C# Main method?

For instance, is white space stripped? Are any of the elements ever empty string or null? How are single and double quotes handled?

MSDN doesn’t explain how and merely says

The parameter of the Main method is a String array that represents the command-line arguments

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:24:51+00:00Added an answer on June 11, 2026 at 9:24 pm

    I believe the args given to Main are those returned by Environment.GetCommandLineArgs() after removing the first of the list. MSDN describes the suprisingly complex logic concerning backslashes:

    Command line arguments are delimited by spaces. You can use double quotation marks (“) to include spaces within an argument. The single quotation mark (‘), however, does not provide this functionality.

    If a double quotation mark follows two or an even number of backslashes, each proceeding backslash pair is replaced with one backslash and the double quotation mark is removed. If a double quotation mark follows an odd number of backslashes, including just one, each preceding pair is replaced with one backslash and the remaining backslash is removed; however, in this case the double quotation mark is not removed.

    Thanks to Christian.K in the comments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following snippet: public class ReflectionTest { public static void main(String[] args) {
I have the following code snippet. public static void main(String[] args) { short a
public static void main (String[] args) { System.out.println(factorial(5)); } public int factorial(int n) {
class ZiggyTest{ public static void main(String[] args) { String str = aaaaaaaaabb; String []
my code is:- class SplitString { public static void main(String[] args) { Pattern p;
Here's the code : public class EmployeeTest { public static void main(String args[]){ //System.out.println(hello
public static void main(String[] args){ Employee [] employeeList = { // build your list
I have the following code class Program { static void Main(string[] args) { List<A>
public static void main(String[] args) { boolean t=true; System.out.println(Before return); if(t) return; System.out.println(not execute);
Server (java): public static void main(String[] args) { //single threaded for now try {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.