Associte Property with Private variable

Hi,
I have a class in which i have one Private variable and one public property.
the code looks like:

Public Class Test
Private m_LocationId As Integer
Private m_LocationName As String

Public Property LocationId() As Integer
    Get
        Return m_LocationId
    End Get
    Set(ByVal Value As Integer)
        m_LocationId = Value
    End Set
End Property

End Class

When i reverse engineered this class in the class diagram, it creates 2 attributes, one as property and the other as private variable. I am curious that how this private memory variable is associated with the property?

on the other hand, I want to create the same class from class diagram, and want to associate the private variable with the propery, so when it generates the setter and getter, it sets and gets the values from private variable. My question is that, how we associate this private variable to the property from class diagram? Does any one have solution to this question?

Hi,

To generate attribute in class diagram to Property in source code with getter and setter, you need to activate the Open Specification of attribute, open the Stereotype page and specify the attribute’s steroretype as “Property”, open the General page and then check getter and setter. Code generating from this attribute will be in the form of Property with getter and setting (skeleton only). However the property will not be associating with any private attribute. I have already forwarded your concern to our engineers to follow-up.

If there are any further questions, please let me know.

Best Regards,
Jick

[quote=Anonymous]Hi,
I have a class in which i have one Private variable and one public property.
the code looks like:

Public Class Test
Private m_LocationId As Integer
Private m_LocationName As String

Public Property LocationId() As Integer
    Get
        Return m_LocationId
    End Get
    Set(ByVal Value As Integer)
        m_LocationId = Value
    End Set
End Property

End Class

When i reverse engineered this class in the class diagram, it creates 2 attributes, one as property and the other as private variable. I am curious that how this private memory variable is associated with the property?

on the other hand, I want to create the same class from class diagram, and want to associate the private variable with the propery, so when it generates the setter and getter, it sets and gets the values from private variable. My question is that, how we associate this private variable to the property from class diagram? Does any one have solution to this question?[/quote]