title: .NET custom property attribute?
body: <p>EDIT:
  I'd better rephrase:
  <strong>How can I shift the GET-implementation of a Class property to a / using a custom attribute?</strong> (I've added instantation vars (classname, propertyname) to the attribute, however I'd rather have these automatically fetched ofcourse.)</p>
  
  <pre><code>Public Class CustomClass
      &lt;CustomAttributeClass(ClassName:="CustomClass", PropertyName = "SomeProperty")&gt; _
      Public Property SomeProperty() as String
          Get() as String
              //This implementation should be handled by the attribute class
          End Get
  
          Set(Byval value as String)
              Me._someProperty = value
          End Set
      End Property
  End Class
  </code></pre>
  
  <hr>
  
  <p>Old question:</p>
  
  <p>I want to create a custom property attribute for classes. I can create a class derived from Attribute, and 'mark' the property with the attribute, but where to go from here?</p>
  
  <p>I have a repository where I can quickly get data based on the attributes values. I would like to generalize the behaviour of the property in the attribute but I don't know how to go from here... Any help would be greatly accepted!</p>
  
  <pre><code>Public Class CustomDataAttribute : Inherits Attribute
      Private _name As String
  
      Public Sub New(ByVal name As String)
          Me.Name = name
      End Sub
  
      Property Name() As String
          Get
              Return _name
          End Get
          Set(ByVal value As String)
              Me._name = value
          End Set
      End Property
  End Class
  
  
  Public Class CustomClass
      &lt;CustomDataAttribute(Name:="CustomField")&gt; _ 
      Public Property CustomField()
      End Property
  End Class
  </code></pre>