Author Topic: C# code generation for #region  (Read 3721 times)

MFruit

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
C# code generation for #region
« on: November 04, 2008, 08:06:50 pm »
Hello,
Is anybody know if is it possible to generate #region code for C# ?
What i saw is that reversing a class with defined #region works well. In fact, i've put in my code one region to define attributes and another one to define operation.

Code: [Select]
   public class Class1
    {
        #region Attribute
        int Attribute1;
        int Attribute2;
        private bool Attribute3;
        #endregion

        #region Operation
        public string Class1Operation2(int Id)
        {
            return "";
        }

        public void Class1Operation1(){ }

        public bool Class1Operation3(int Id2){
           return true;
        }
        #endregion
    }

Then reverse the class. Under Enterprise Architect i add one attribute and one operation. The generating works well because the new attribute is created into #region Attribute and the new operation into #region Operation.

My question is to know if we can define region under Entreprise Architect to generate the first time a class with pre-define region ?

Thx.
« Last Edit: November 04, 2008, 08:08:26 pm by MFruitEA »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: C# code generation for #region
« Reply #1 on: November 05, 2008, 08:01:03 am »
Modify the code templates.

You'll find a list over attributes and a list over operations.  Just add the appropriate region code (in plain text) to the template and you'll be fine.