Possible Duplicate:
Differences in string compare methods in C#
I know that in C# strings are objects, and I just learned about the CompareTo method when comparing two strings. But what if I need to compare the string to a specific text value?
Now I'm doing this:
private string choice;
[...some code...]
if (choice == "1")
{
Console.WriteLine("You choose 1");
Console.ReadLine();
}
else if (choice == "2")
{
Console.WriteLine("You choose 2");
Console.ReadLine();
}
etc...
And it works just as I want. But is it good coding? Can not find any information on this specific topic.