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)
     Template Binding - returning a List<String>

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
jblake
Posted on: 2012/10/6 3:33
Just popping in
Joined: 2012/10/6
From:
Posts: 1
Template Binding - returning a List<String>
This is in a C# Astah project. I want to generate code that looks like:

Quote:

class TestClass {
List<String> GetListOfStrings() {

}

void SetListOfStrings(List<string> StringList) {

}
}

How do I do this in a class diagram? I've got the C# packages in my astah project. I've tried adding a StringList to the class diagram and drawing a Template Binding arrow to the List<T> class from the C# namespace. But I can't figure out how to set the Type.

I don't know, can anyone help me out here?
Joba
Posted on: 2012/10/9 13:59
Developer
Joined: 2006/6/6
From:
Posts: 969
Re: Template Binding - returning a List<String>
Hi, thank you for your post.

Please follow the step below.

1) Drag and drop the List<T> from the structure tree to Class diagram







2) Create a Class (Class1 in this sample figure) and create a Template Binding from this class to List<T>






3) Delete the Class name from Class1 - one you created at step2






4) Specify String for Template Parameter's Actual Parameter. To do so, select Template Binding in the diagram, go to its property view (Left bottom pane of Astah), select [Template Parameter] tab and then select string from dropdown list for the Actual Parameter







Now you have models as below.






By using List<String> Class for TestClass, you should be able to export code as you wish.
Hope this helps.

Cheers,
SJ
Threaded | Newest First Previous Topic | Next Topic | Top