Book a Demo

Author Topic: C# Property Get/Set values  (Read 4537 times)

zaknixon

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
C# Property Get/Set values
« on: April 14, 2008, 11:45:56 pm »
Can one set the private class variables that are get/set by a C# property, just by declaring it in EA instead of writing the actual code ?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: C# Property Get/Set values
« Reply #1 on: April 14, 2008, 11:52:16 pm »
Yes,

Open the Tools | Options |Source Code Engineering dialog. Take a look at the section about 2/3 of the way down, starting with "Remove prefixes when generating Get/Set properties."

David
No, you can't have it!

zaknixon

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: C# Property Get/Set values
« Reply #2 on: April 15, 2008, 07:05:10 pm »
So, EA will define my private instance variables that match with a property field, and I can't link my own if I already defined it ?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: C# Property Get/Set values
« Reply #3 on: April 15, 2008, 09:55:48 pm »
I'm not sure exactly what you mean.

For new attributes, create the attribute with a listed prefix, something like m_myAttribute. Save the attribute, then click the Property box - the box will not be enabled until you save the attribute.

You'll receive a dialog that will provide you with options (read/write etc.) and show you the property name, in the default case it would be MyAttribute.

As to what you've done so far, you will likely have to edit by hand, but I cannot be sure. Perhaps the same Property can be used to 'attach' a property you have already created; I just have not tried.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +118/-20
    • View Profile
Re: C# Property Get/Set values
« Reply #4 on: April 16, 2008, 08:22:13 am »
If you already have an attribute and property.  Open the tagged values for the property method and add one "attribute_name" and give it the name of the attribute used.