你如何在UML中建模c#属性?

时间:2009-04-01 09:44:28

标签: c# attributes uml

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

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

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

你如何建模:

[AttributeForTheClass]和[AttributeForTheField]和[AttributeForTheMethod]

目前我们使用的是Sparx Enterprise Architect。

我知道c#属性是一种c#语言特性,但我不确定它们是否都是用UML定义的。

任何人都有解决方案吗?

2 个答案:

答案 0 :(得分:0)

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

从建模视图来看,它们应该是刻板印象,属性的任何参数都应该是标记值,但如果可以,则更容易使用工具支持的内容。

答案 1 :(得分:0)

EA导入属性为标记值,​​名称为“Attribute”,属性文本连接为值:

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