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.

 

extension

Operation

A Class extension method, represented in code by a this parameter in the signature.

 

indexer

Operation

A property acting as an index for this Class.

 

partial

Operation

The partial keyword on an operation.

 

property

Operation

A property possibly containing both read and write code.

 

struct

Class

A struct type.

 

 
Tagged Values

Tag

Applies To

Corresponds To

argumentName

Operation with stereotype extension

The name given to this parameter.

 

attribute_name

Operation with stereotype property or event

 

The name of the variable behind this property or event.

className

Operation with stereotype extension

The Class that this method is being added to.

 

const

Attribute

The const keyword.

 

definition

Operation with stereotype partial

Whether this is the declaration of the method, or the definition.

 

delegate

Operation

The delegate keyword.

 

enumType

Operation with stereotype property

The datatype that the property is represented as.

 

extern

Operation

The extern keyword.

 

fixed

Attribute

The fixed 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

Namespaces are generated for each package below a namespace root
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

Learn more