Enum c#
namespace CSharpTutorial
{
enum Browser
{
Firefox,
Chrome,
Safari,
IE
}
class Program
{
public static void Main(string[] args)
{
Console.WriteLine(getBrowser(Browser.Chrome));
Console.ReadKey();
}
public static String getBrowser(Browser browser)
{
if (browser == Browser.Chrome)
return "Opening the Chrome Browser";
else if (browser == Browser.Firefox)
return "Opening the Firefox Browser";
else if (browser == Browser.IE)
return "Opening the IE Browser";
else
return "Opening the Safari Browser";
}
{
enum Browser
{
Firefox,
Chrome,
Safari,
IE
}
class Program
{
public static void Main(string[] args)
{
Console.WriteLine(getBrowser(Browser.Chrome));
Console.ReadKey();
}
public static String getBrowser(Browser browser)
{
if (browser == Browser.Chrome)
return "Opening the Chrome Browser";
else if (browser == Browser.Firefox)
return "Opening the Firefox Browser";
else if (browser == Browser.IE)
return "Opening the IE Browser";
else
return "Opening the Safari Browser";
}
Comments
Post a Comment