C# Conventions

Enterprise Architect supports the round trip engineering of C#, where the following conventions are used.

Stereotypes

Stereotype

Applies to

Corresponds To

enumeration

Class

An enum type.

event

Operation

An event.

indexer

Operation

A property acting as an index for this Class.

property

Operation

A property possibly containing both read and write code.

struct

Class

A struct type.

Tagged Values

Tag

Applies to

Corresponds To

attribute_name

Operation with stereotype property or event

The name of the variable behind this property or event.

const

Attribute

The const keyword.

delegate

Operation

The delegate keyword.

enumType

Operation with stereotype property

The datatype that the property is represented as.

extern

Operation

The extern keyword.

generic

Operation

The generic parameters for this Operation.

genericConstraints

Templated Class or Interface, Operation with tag generic

The constraints on the generic parameters of this type or operation.

Implements

Operation

The name of the method this implements, including the interface name.

ImplementsExplicit

Operation

The presence of the source interface name in this method declaration.

initializer

Operation

A constructor initialization list.

new

Class, Interface, Operation

The new keyword.

override

Operation

The override keyword.

params

Parameter

A parameter list using the params keyword.

partial

Class, Interface

The partial keyword.

readonly

Operation with stereotype property

This property only defining read code.

sealed

Operation

The sealed keyword.

static

Class

The static keyword.

unsafe

Class, Interface, Operation

The unsafe keyword.

virtual

Operation

The virtual keyword.

writeonly

Operation with stereotype property

This property only defining write code.

Other Conventions

  • The Const property of an attribute corresponds to the readonly keyword, while the tag const corresponds to the const keyword
  • The value of inout for the Kind property of a parameter corresponds to the ref keyword
  • The value of out for the Kind property of a parameter corresponds to the out keyword
  • Partial Classes can be modeled as two separate Classes with the partial tag
  • The Is Leaf property of a Class corresponds to the sealed keyword.

See Also