Setting C# in Astah

Astah Professional and UML support modeling in Java, C++, and C#. If you are modeling in C#, set the project language to C# first:

  1. Select the root package in the Structure Tree and check [C#] in the bottom pane.
    Setting the project language to C#
  2. With C# set, you can edit C#-specific attributes for Classes, Attributes, and Operations in the [Language] tab.
    C#-specific options in the Language tab

Import C# source code

You can import C# source code using the free C# Reverse Plug-in.

section divider

Export C# source code

Astah can generate C# skeleton code from selected diagram elements. The definitions of classes and operations are exported as documentation comments.

  1. Go to [Tools] – [C#] – [Export C#] in the main menu.
    Export C# menu
  2. Select the target folder and the classes to generate .cs files from by moving them from the “Candidate List” to the “Selected List”. Make sure you choose the correct charset, then click [OK].
    Export C# from UML
  3. The source code files are generated. If files with the same names already exist, they are completely replaced by the latest export. To keep modifications you’ve made to existing .cs files, check the [When overwriting, keep the information of existing code that is not in the model.] option.
    C# export option