C# - Terminology - Field vs. member

The dictionary defines a member as 'a constituent part of a whole'.

In C#, there are class members and struct members. I.e. parts of a class, and parts of a struct.


A member is a field, property or method within a class or struct.


A field is a type of member that is accessed directly within the class or struct.


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);
      }
  }
  

Ads by Google

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

© Richard McGrath