1

我想在 UML 中对 c# 类属性和变量属性(不是 UML 属性)进行建模,但不知道该怎么做。

[AttributeForTheClass]
class SomeClass
{
    [AttributeForTheField]
    int SomeField;

    [AttributeForTheMethod]
    int SomeMethod(
        [AttributeForTheParameter]int someParam)
    {
        ...
    }
}

你如何建模:

[AttributeForTheClass] 和 [AttributeForTheField] 和 [AttributeForTheMethod]

目前我们使用 Sparx Enterprise Architect。

我知道 c# 属性是 ac# 语言功能,但我不确定它们是否在 UML 中定义。

有人有解决方案吗?

4

2 回答 2

0

当您对某些具有属性的 C# 代码进行逆向工程时会发生什么?你有刻板印象或标记值吗?

从建模的角度来看,它们应该是原型,属性的任何参数都应该是标记值,但如果可以的话,使用工具支持的东西会更容易。

于 2009-04-01T09:52:59.660 回答
0

EA 将属性导入为名称为“Attribute”的标记值,并将属性文本连接起来作为值:

[WebService(Namespace = "http://dataservice/")];[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)];[System.ComponentModel.ToolboxItem(false)]

于 2009-04-01T11:47:40.977 回答