Book a Demo

Author Topic: C# 'using' statement  (Read 2936 times)

dhait

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
C# 'using' statement
« on: June 29, 2006, 10:16:23 pm »
When I generate a C# class, how do I get the "using" statement in the top of the class file?

Example:  the class Class1 has a property called m_ds, which is of type "DataSet", found in namespace System.Data.

How do I get my class diagram to insert

using System.Data;

at the top?
« Last Edit: June 29, 2006, 10:16:41 pm by dhait »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C# 'using' statement
« Reply #1 on: June 29, 2006, 11:00:06 pm »
Well, you have a couple of options.  You can import DataSet from the .Net assembly (sorry, I don't know which one from the top of my head) and then ensure that the attribute has the classifier set properly.  Once that is done a using statement will be generated for it.

Alternatively you could just add 'using System.Data;' to the field for imports in the code generation dialog (for a single class)

dhait

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: C# 'using' statement
« Reply #2 on: June 29, 2006, 11:16:25 pm »
Sorry, for option 1, how do I set the classifier on a Class attribute?  It looks like you can only set the classifiers for Objects.
« Last Edit: June 29, 2006, 11:16:55 pm by dhait »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C# 'using' statement
« Reply #3 on: July 03, 2006, 03:55:48 pm »
Attributes, operations and parameters all have a little '...' button next to their type that allows setting the classifier of that type.