I am trying to teach myself C#. I recently completed this exercise. The code works the the way its suppose to. My question is how could I make this more efficient or is there bad programing practices? Thanks
using System;
class testcontact
{
public static void Main()
{
InputWrapper iw = new InputWrapper();
string cmd;
do
{
Console.WriteLine("Add"); // menu of options
Console.WriteLine("Remove");
Console.WriteLine("Forward");
Console.WriteLine("Reverse");
Console.WriteLine("Find");
Console.WriteLine("Quit");
cmd = iw.getString(">"); // user input from Input wrapper class
switch (cmd)
{
case ("add"): // new contact
Console.WriteLine("\nAdding new contact\n");
break;
case "remove": // remove contact
Console.WriteLine("\nRemoving contact\n");
break;
case "forward": //sort forward
Console.WriteLine("\nSorting contacts forward\n");
break;
case "reverse": // reverse sort
Console.WriteLine("\nRevers contact sort\n");
break;
case "find": // find contact
Console.WriteLine("\nFind contact\n");
break;
default: // all invalid commands will go here
Console.WriteLine("valid commands are \n add \n remove \n forward \n reverse \n find quit\n");
break;
}
}
while (cmd != "quit");
}
}