如何重新present UML中的C#属性? [英] How to represent a C# property in UML?

查看:83
本文介绍了如何重新present UML中的C#属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不太一种属性,并不完全是方法。定型? <<获得>> <<集>>

Not quite an Attribute, not quite a Method. Stereotypes? <<get>> <<set>>?


我的复古造型现有的系统,所以我需要清楚地反映,这是不一样的只读域或方法对(不管IL所说的话),所以我觉得我LL与刻板印象去,但我会接受的语言独立获得的SET_作为一个通用的解决方案。感谢所有完整性测试。*

I'm retro-modelling an existing system, so I need to clearly reflect that this is not the same as a readonly field or a methods pair (regardless of what the IL says), so I think I'll go with the stereotype, but I'll accept the language independant get set_ as a general solution. Thanks all for the sanity test.*

推荐答案

属性是写作的一种简便方法 get_MyValue() set_MyValue(值)允许分配,而不是正常的方法调用(用括号中)。

Properties are just a convenient way of writing get_MyValue() and set_MyValue(value) allowing assignment rather than the normal method calling (using parenthesis).

你所访问实际上是一个.NET属性,C#有它自己的语法来访问这些。因为皮肤下的实获得_ 设置_ 方法创建的,所以你可以简单地显示这些方法(让你的UML语言独立的 - 比如让你的UML同样适用于VB.NET开发者)

What you are accessing is actually a .NET property, C# has its own syntax for accessing these. Since under the skin the real get_ and set_ methods are created, so you could simply show those methods (to make your UML language independent - e.g. make your UML equally applicable to a VB.NET developer)

...或者你建议,介绍你自己的刻板印象!

... or as you have suggested, introduce your own stereotype!

这篇关于如何重新present UML中的C#属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆