0

Very often I need to name generated methods which operate on both fields and properties with the same intention of setting it. Is there a word that covers both of these terms?

toplel32
  • 1,162
  • 1
  • 7
  • 22
  • 4
    "Class members" ;) Being serious - why do you want to mix it? It's pretty different things, and I don't think mixing them is a good idea. – Andrey Korneyev Oct 31 '14 at 09:18
  • 2
    @AndyKorneyev ["Member" includes](http://msdn.microsoft.com/en-us/library/aa645622(v=vs.71).aspx) methods, events, constructors, nested types, etc. – dcastro Oct 31 '14 at 09:19
  • 1
    Are you looking for the word "Member"? – Sriram Sakthivel Oct 31 '14 at 09:19
  • @AndyKorneyev Instance member is the more appropriate word. Class member could mean static member. – Sriram Sakthivel Oct 31 '14 at 09:20
  • @SriramSakthivel - I need to narrow it down, a method is a member too. – toplel32 Oct 31 '14 at 09:20
  • Can you give an example? – Patrick Hofman Oct 31 '14 at 09:21
  • @AndyKorneyev - It is part of an ORM, if you are familiar with that, then it may all make sense now. – toplel32 Oct 31 '14 at 09:21
  • 1
    @toplel32 Well, a `Property` is effectively a `Method`. get and set methods ;) – Sriram Sakthivel Oct 31 '14 at 09:22
  • Somehow the word "state" seems to be a focus point. – Marvin Smit Oct 31 '14 at 09:22
  • 1
    @SriramSakthivel - I need a name thats based on the semantics of the language, not the IL representation. – toplel32 Oct 31 '14 at 09:23
  • 1
    I don't think a widely used term exists. You may have to come up with one - i'd suggest "data member" for fields/properties/indexers. Other members tend to define behaviour, not data/state. – dcastro Oct 31 '14 at 09:26
  • 2
    I would call `Data members`. You can look at [DataMemberAttribute](http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datamemberattribute(v=vs.110).aspx) they only applied to `Properties` and `Fields` – Renatas M. Oct 31 '14 at 09:27
  • @dcastro Properties can define behaviour too because of possible side effects in setters. – Andrey Korneyev Oct 31 '14 at 09:28
  • @AndyKorneyev - That would be an implementation detail, from the standpoint of an ORM, these details do not matter. What matters is that I have a member, and I can change the data covered by the member, for that I need a common term. – toplel32 Oct 31 '14 at 09:30
  • @AndyKorneyev Good practices dictate that properties should not have any *observable* side effects. See [here](http://stackoverflow.com/a/20195519/857807). – dcastro Oct 31 '14 at 09:34
  • I think I'll go with 'DataMemberMutator'. – toplel32 Oct 31 '14 at 09:36

1 Answers1

1

The word is 'Member'.

If you use reflection to get properties, fields, or methods on a class you get: PropertyInfo, FieldInfo and MethodInfo instances. All of these inherit from MemberInfo.

Ananke
  • 1,250
  • 9
  • 11
  • Thats right, but read the comments. – toplel32 Oct 31 '14 at 09:31
  • They are generally called members: http://msdn.microsoft.com/en-us/library/ms173113.aspx – Ananke Oct 31 '14 at 09:32
  • @Ananke - Yes, you are right, but OP is looking for a term that includes fields and properties, but excludes methods and everything else. So my vote would also go to DataMember. – Corak Oct 31 '14 at 09:35