StarUML的C#扩展
This extension for StarUML supports C# code generation from a UML model. It also allows converting C# code into a UML model. Install this extension from Extension Manager of StarUML.
This extension does not provide perfect reverse engineering, which is a test and temporal feature. If you need a complete reverse engineering feature, please check other professional reverse engineering tools.
This extension is based on C# 2.0 specification.
Tools > C# > Generate Code...
)Below are the rules to convert UML model elements to C# source code.
.cs
file)visibility
to one of modifiers public
, protected
, private
and none.isAbstract
property to abstract
modifier.isFinalSpecialization
and isLeaf
property to sealed
modifier.stereotype
= struct
then converted to C# Struct.visibility
property to one of modifiers public
, protected
, private
and none.name
property to field identifier.type
property to field type.multiplicity
property to array type.isStatic
property to static
modifier.isLeaf
property to sealed
modifier.defaultValue
property to initial value.visibility
property to one of modifiers public
, protected
, private
and none.name
property to method identifier.isAbstract
property to abstract
modifier.isStatic
property to static
modifier.direction
= return
to return type of method. When no return parameter, void
is used.isReadOnly
= true
to sealed
modifier of parameter.stereotype
= property
then converted to C# Property.isReadOnly
just the getter is generated..cs
file)visibility
property to one of modifiers public
, protected
, private
and none..cs
file)visibility
property to one of modifiers public
, protected
, private
and none.visibility
property to one of modifiers public
, protected
, private
and none.name
property to field identifier.type
property to field type.multiplicity
is one of 0..*
, 1..*
, *
, then collection type (List<>
when isOrdered
= true
or HashSet<>
) is used.defaultValue
property to initial value.:
).:
).Tools > C# > Reverse Code...
)CsharpReverse
model will be created in the Project.Below are the rules to convert from C# source code to UML model elements.
name
property.public
, protected
and private
to visibility
property.abstract
modifier to isAbstract
property.sealed
modifier to isLeaf
property.<<constructor>>
.Field type to type
property.
type
property has the primitive type name as string.T[]
(array) or its descendants: type
property refers to T
with multiplicity *
.T
(User-Defined Types) : type
property refers to the T
type.type
property has the type name as string.Access modifier public
, protected
and private
to visibility
property.
static
modifier to isStatic
property.sealed
modifier to isLeaf
and isReadOnly
property.defaultValue
property.Field type to end2.reference
property.
T[]
(array) or its descendants: reference
property refers to T
with multiplicity *
.T
(User-Defined Types) : reference
property refers to the T
type.Access modifier public
, protected
and private
to visibility
property.
public
, protected
and private
to visibility
property.static
modifier to isStatic
property.abstract
modifier to isAbstract
property.sealed
modifier to isLeaf
property.name
property.public
, protected
and private
to visibility
property.name
property.public
, protected
and private
to visibility
property.<<annotationType>>
.name="default"
).Licensed under the MIT license (see LICENSE file).