C# - terminology - field vs. member

The term member can refer to either a class member or a struct member.


C# members include fields (struct and class), properties (class only), and methods (class only).


The dictionary defines member as: A constituent part of a whole.


An example:


  class Test // a class
  {
      private string _firstName; // a member. a field.
      public string FirstName // a member. a property
      {
          get { return _firstName; }
      }
      
      public void Print() // a member. a method
      {
          Console.WriteLine("Hello " + _firstName);
      }
  }
  

The constitutent parts of a class are called class members.


Ads by Google



Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath