Unfortunately I am still working on .NET 2.0. I have not created a custom attribute before.
I want to create a `CustomStringFormatAttribute`:.

If a class, say Customer.Name, has:

```
MaxLength=30
ActualLength=10

```

I need to pad it with empty spaces till it reached 30.

I also need an attribute for date that I can format like DisplayDataFormat

I have created the following but **How do I get access to the actual value of the property within the attribute?**

```
public class Customer
{
    [CustomStringFormatAttribute(30)]
    public string Name { get; set; }

    //todo:customDateAttribute
    public DateTime StartDate { get; set; }
}

[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
public sealed class CustomStringFormatAttribute : Attribute
{
    private readonly int maxLength;

    public CustomStringFormatAttribute(int maxLength)
    {
       MaxLength = maxLength;
    }

    public  int MaxLength { get; private set; }

    //?Should I override ToString 
    public override string ToString()
    {
        return Format();
    }

    private string Format()
    {
        //simplified version of my formatting for brevity
        string source = "value from the property of the class.";//How do I get access to the actual value of the property within the attribute?
        const char paddingChar = ' ';
        return source.PadLeft(maxLength, paddingChar);
    }    
}

```

Any suggestions?

Note: I' used automatic property for brevity. I don't have that luxury in .NET 2.0.