What is the appropriate method to read arguments from command line? I've read of using strings args[] but I can't come to grasp the concept of how to do it properly.
Example Commands:
/animal dog -c white -s medium
/car civic -c green -y 1999
What would be the appropriate manner to read,
/thecommand
all the other -letter arguments
for easier manipulation? Or is there a cleaner way in general to do this than using args? Still not sure as to how args is used.
static void Main(string[] args)
{
Console.WriteLine("Welcome To The Application");
Console.Write("Program> "); // Expecting something such as: /animal dog -c brown -s medium
string sInput = Console.ReadLine();
// What would be an appropriate method to read 1. /thecommand then based on the command
// maybe using switch, expect the arguments like -c brown -s medium or -c green -y 1999
// and display them into the console?
// if /animal is detected, display what would be:
// Console.WriteLine("Animal: dog");
// Console.WriteLine("Color: brown");
// Console.WriteLine("Size: medium");
// if /car is detected, display what would be:
// Console.WriteLine("Car: civic");
// Console.WriteLine("Color: green");
// Console.WriteLine("Year: 1999");
}