I am not sure what is the correct name for what I am looking for!
What I am trying to do is to make a method to update a status bar text, and color it as red if it is a error message or green if it is a success message:
public void UpdateStatus(string message, MessageType type)
{
if(type == MessageType.Error)
{
statusText.Text = message;
statusText.ForeColor = Color.Red;
}
if(type == MessageType.Success)
{
statusText.Text = message;
statusText.ForeColor = Color.Green;
}
}
And here is the MessageType
public class MessageType
{
class Error
{
//What to do here?
}
class Success
{
//What to do here?
}
}
So how can I define this MessageType class, and how is it called? Interface? Enum? what??
Thanks.
P.S: I know I can just use Color as the second parameter for UpdateStatus method I wrote, but I want to learn how to make it like what I said.
You’re trying to make an
enumtype: