Instance attribute values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ljlevend

    Instance attribute values

    Is there any way to have an attribute with a value that is unique to an
    instance of an object? For example, let say I have the following:

    Public Class MyAttribute
    Inherits System.Attribut e
    Public Value As Boolean
    Public Sub New(ByVal value As Boolean)
    Me.Value = value
    End Sub
    End Class

    Public Class MyClassWithAttr ibute
    <MyAttribute(Tr ue)> _
    Public Property SomeProperty As Object
    ...
    End Property
    End Class

    Public Class MyWorkingClass
    Public myClassWithAttr ibute1 As New MyClassWithAttr ibute
    Public myClassWithAttr ibute2 As New MyClassWithAttr ibute
    ...
    End Class

    Now, what I want to do is to be able to set MyAttribute.Val ue of
    myClassWithAttr ibute1.SomeProp erty to False, but to keep MyAttribute.Val ue of
    myClassWithAttr ibute2.SomeProp erty set to True. Is this possible?

    Thanks,
    Lance

Working...