I need to tell if a user entered the local machine's name in a textbox. This turns out to be trickier than I originally thought.
string userInput = inputTextbox.Text.ToLower();
string machineName = Environment.MachineName.ToLower();
bool isLocal = userInput.Equals(machineName ) || // This is what we started with...
userInput.Equals(".") || // Then we added this...
userInput.Equals("localhost"); // And then we added this...
As you can see, it's gotten quite messy and unmaintainable. For example, the address 127.0.0.1 wasn't included. Our testing department keeps writing bugs every time they find a new name for home. We need to squash this bug once and for all.
Is there an easier way to do this?