It's very useful to take an enum and bind it into bind-able controls (like drop down list, check box, grid view and etc). For example, if we have an enum which represents bug statuses and you want to bind it into a drop down list. public enum Bug { Opened = 1, Closed = 2, Rejected = 3, Resolved = 4, InProgress = 5 } In addition, usually in a UI we want to separate between the enum words (for example to change the "InProgress" to "In Progress"). I search over the net and I...
It's a best practice to work with strong types instead of typing the name of the class/properties by our own hands. One of the common places that we are usually typing a string is when we're retrieving data from configuration file. In this post I will show you how to declare a custom configuration section with a strongly typed class. 1. Declare the configuration section in configuration file: < configSections > < section name = " serviceSettings " type = " ServiceSettingsHandler...
There are many scenarios it is recommended to use an embedded resource which is part of the assembly. One of the common cases is having a custom control with custom script file and wanting to ship them in a close assembly to other projects. Thanks to deployments reasons we prefer to ship only the assembly without the other resource files. There is a simple approach to do it in .Net 2.0. Ok, what do we have to do in order to accomplish this task? Assumptions: - We have a custom control which is called...