Geeks With Blogs
Deeksha Sharma
open visual studio 2010-> open console project
go to Properties -> debug->{start  options-command line arguments}

write your command line arguments here

Read it:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReadCommandArgument
{
    class Program
    {
        static void Main(string[] args)
        {
            foreach (string arg in args)
                Console.WriteLine(string.Format("Arg: [{0}]", arg));

            // Ex 2: Use 1st argument as filename
            if (args.Length > 0)
                Console.WriteLine(string.Format("File={0}", args[0]));
            Console.ReadLine();
        }
    }
}

Posted on Wednesday, July 23, 2014 10:38 AM | Back to top


Comments on this post: set command line argument and read it from there

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Deeksha Sharma | Powered by: GeeksWithBlogs.net