Parameters

Parameters are divided into formal parameters and actual parameters Formal Parameters The formal parameter, full name Formal Parameter, is also commonly known as a parameter or formal argument. A formal …

Local Functions

These are known as Local Functions in English, introduced starting with C# 7.0. We previously covered method invocation. Inside a method body, you may call other methods following these rules: …

return inside void methods

We briefly touched on this in the last lesson: you can actually write return even inside methods with a void return type. Methods with a return value require a return …

Return Value

A method can return data to the calling code, and the return value will replace the calling expression directly. If your method needs to return data, you have to declare …

Method Calls

You can call other methods from within a method. Methods are able to call other methods, and those methods can call even more methods. You can invoke multiple methods inside …

Program Control Flow

The English term for program control flow is: Flow of Control When we build a program, most of our logic lives inside methods. The rest can be found within properties, …

Local Constants

Local Constants Local constants work much like local variables, with one key difference: once initialized, their value cannot be modified. Just like local variables, constants must be declared inside a …

Nested Code Blocks and Scope

We touched on this topic in earlier lessons, but we’ll reinforce your understanding by examining memory storage in this section. This tutorial is from foxdevelop.com. Please cite the source when …

Type Inference

Type Inference and the var Keyword Take a look at the code below. The data type specified at the start of each variable declaration can be automatically determined by the …

Method

A method is a named block of code. You can run this block by calling its name elsewhere in your program, pass data into the method, and receive output values …

Access Modifiers

Inside a class, any member function can directly access all other members of the same class by name. Access modifiers are optional prefixes used in member declarations. They control whether …

Instance Members

A class declaration acts like a template or blueprint. You can create any number of class instances from it. Instance Members: Every instance of a class is a separate entity …

Class definition

Procedural Programming vs Object-Oriented Programming Before the emergence of classes, languages such as C had no concept of classes. Programming languages without classes and objects like C are known as …

Variable

Classification of Value Types and Reference Types Predefined Built-in Types Category Included Types Value Types (Primitive Numeric / Boolean / Char) Signed integers: sbyte, short, int, longUnsigned integers: byte, ushort, …

Value Types vs Reference Types

The data item type determines two key aspects: the memory footprint (number of bits) required to store it, and the data members contained within the type. Additionally, the type dictates …

Stack vs Heap

When a program runs, data must be loaded into memory. The space data occupies and its storage location are determined by its data type. Two memory regions are used to …

User-defined Types

Custom Types Besides the 16 predefined built-in types native to C#, developers can create their own custom user types, split into six categories total: Custom types are created through type …

Built-in Types

C# comes with 16 built-in predefined types, split into 13 simple types and 3 non-simple types. All names for predefined types are written entirely in lowercase. 13 Simple Types Key …

Class Members

Class members fall into two categories: data members and function members Simple types like int, long and short we’ve covered earlier are built straight into .NET. Microsoft’s developers coded these …