Fundamental Elements

A C# program is best understood in terms of three basic elements:

Functions

Perform an action by executing a series of statements. For example, you may have a function that returns the distance between two points or a function that calculates the average of an array of values. A function is a way of manipulating data.

Data

Values that functions operate on. For example, you may have data holding the coordinates of a point or data holding an array of values. Data always has a particular type.

Types

A set of data members and function members. The function members are used to manipulate the data members. The most common types are classes and structs, which provide a template for creating data. Data is always an instance of a type.

Get C# Language Pocket Reference 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.