How to Handle Console Application Arguments using C#

Shubham
Posted by Shubham under C# category on | Points: 40 | Views : 3111
This program helps beginners to get the arguments passed on command line in C# program. you can read these arguments from main method.
====================================================================================================================================

using System;

class console_arguments_class
{
public static void Main(string[] my_args)
{
Console.WriteLine("Number of Arguments: " + my_args.Length);
for (int i = 0; i < my_args.Length; i++)
{
Console.WriteLine("Argument # " + i + ": " + my_args[i]);
}

Console.ReadLine();
}
}


plzzz run copy on notepad then pass the command line argument.....

Comments or Responses

Login to post response