In Depth Banner
Skip Navigation Links

Select your preferred language

The Attributes

  [AttributeUsage(AttributeTargets.Field)]

  public class ConfigurableAttribute : Attribute

  {

    public ConfigurableAttribute()

    {

    }

  }

 

 

  [AttributeUsage(AttributeTargets.Field | AttributeTargets.Class, AllowMultiple=true)]

  public class ConfigurablePropertyAttribute : Attribute

  {

    string _propertyName;

    public string PropertyName

    {

      get{return _propertyName;}

    }

 

    protected ConfigurablePropertyAttribute()

    {

    }

 

    public ConfigurablePropertyAttribute(string name)

    {

      _propertyName=name;

    }

  }

 

As you can clearly see, there's nothing complex about these attributes. The first, ConfigurableAttribute, just needs to be present. The second, ConfigurablePropertyAttribute, enables you to specify the name of the property to save.

Return to the article.

Copyright © Bob Powell 2003-2009. All rights reserved