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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.