Function Members

C# has a rich set of function members, as you saw in the introduction of this chapter, but even though they are called different names and are meant for different purposes, they all contain a block of statements that are executed when called, just like our conventional method, which we will focus on in the next section.

Methods

Methods can be divided into two main groups—instance methods (defined without the static keyword) that belong to the group of instance functions (see the note in Syntax Box 12.2) and static methods (defined with the static keyword) that belong to the group of static functions. An instance method is executed in relation to a specific object; it needs an object to be executed. In contrast, a static method ...

Get C# Primer Plus now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.