Saturday, 3 January 2015

How To Read Input From Console in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.OleDb;
using System.Net;
using System.Collections;
namespace readInputsFromConsole
{
class Program
{
public static string siteURL = null;
public static string inputExcelFile = string.Empty;
static void Main(string[] args)
{
// Read the Requires parameter to get the path of the input files
//Start
if (args == null || args.Length < 2)
{
Console.WriteLine("ERROR in input...");
Console.WriteLine("Enter an valid Input");
Console.ReadLine();
return;
}
siteURL = args[0];
inputExcelFile = args[1];
readExcel(siteURL, inputExcelFile);
//End
//If you want to hard code use below code.. Start
/*
siteURL = "www.google.com";
inputExcelFile = @"C:\MyData.xlsx";
readExcel(siteURL, inputExcelFile);
*/
//If you want to hard code use below code.. End
}
}
}
view raw gistfile1.cs hosted with ❤ by GitHub