Main Menu
Login
SSL SecureMode
Username:
Password:  
Lost Password?
Register now!
ChangeVision Members Map
Search
Forum Index   -   Topic Index
   How to use of Astah (Pro/SysML/GSN/Com)
     [Class diagram] Exporting generic type parameter to C#

Flat Previous Topic | Next Topic
Poster Thread
midori
Posted on: 2015/4/27 10:21
Developer
Joined: 2006/7/3
From:
Posts: 324
Re: [Class diagram] Exporting generic type parameter to C#
Hello Thatar,

Thank you for your detailed explanation.

Generics can also be created from the property view.

1) Go to [File] - [New By Template] - [b. C_Sharp.asta] to use a C# template file which includes the System package for C#.

2) Create MyClass and MyList attribute in a class diagram as shown below:








3) Input List<int> in the Type field of the Base tab of MyList attribute property view and press Enter.











4) You will be asked to create a new class List<int> and press Yes.














5) List<int> will be created as an anonymous bound class.








Regarding the anonymous bound class, if you drag & drop List<int> from the structure tree to the class diagram and go to [Show Related Elements] in the class popup menu, you will see the following relationship.


















6) Finally, go to [Tool] - [C#] - [Export C#] and export MyClass. The following code will be generated


using System.Collections.Generic;

public class MyClass
{
	private List<int> MyList;

}


Cheers,
Midori
Flat Previous Topic | Next Topic

Subject Poster Date
   [Class diagram] Exporting generic type parameter to C# Thatar 2015/4/4 19:49
     Re: [Class diagram] Exporting generic type parameter to C# webmaster 2015/4/6 17:03
     Re: [Class diagram] Exporting generic type parameter to C# webmaster 2015/4/7 11:52
       Re: [Class diagram] Exporting generic type parameter to C# Thatar 2015/4/8 17:26
         Re: [Class diagram] Exporting generic type parameter to C# Thatar 2015/4/8 18:31
           Re: [Class diagram] Exporting generic type parameter to C# webmaster 2015/4/9 17:33
             Re: [Class diagram] Exporting generic type parameter to C# Thatar 2015/4/12 22:56
               Re: [Class diagram] Exporting generic type parameter to C# webmaster 2015/4/14 18:08
               » Re: [Class diagram] Exporting generic type parameter to C# midori 2015/4/27 10:21