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;
namespace MyApp
{
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();
}
}
}
No comments:
Post a Comment