Category:
ASP.Net 2.0
In my previous post I wrote about how we can create a configuration section. There is an easier way of creating one. We can create a Configuration section with adding attributes to our properties:
using System.Configuration; using System.Web.Configuration;
namespace Nsquared2.Web.Configuration {
public class MySection: ConfigurationSection {
[ ConfigurationProperty("myAttribute", DefaultValue ="myAttribute")] public string MyAttribute { get { return ((string)base["myAttrbiute"]); } set { base["myAttribute"] = value; } } } }
This will required less code and will make it easy for us to create our own sections.
|