logic - C# Visible values of enum -
i beginner in programming , have problem enums. maybe impossible want. here code:
public static class browser { public static webbrowser browser = webbrowser.ie; public static resolution resolution = getres(browser); public static resolution getres(webbrowser browser) { resolution res; if(browser == webbrowser.chrome) { // compilator_error: res = resolution._800x600; // not_error: res = resolution._1024x768; } return res; } } public enum webbrowser { chrome, firefox, ie, opera } public enum resolution { _800x600, _1024x768, _1280x800 }
i have created method want magic. if browser
webbrowser.chrome
, res
visible _1024x768, _1280x800
resolution
. if not, compilator error. maybe bad solution enums, hope understand want do. there optimal way how this?
Comments
Post a Comment