C# Methods

In this article, you will learn about how to create a method in C# and call it. Also, you will learn about various type of passing parameter to a method, and much more. Method in C# A method (or function) is a block of code that can be declare inside a class.  Methods are useful... » read more

C# Do while loop

In this lesson, we will learn about the do while loop and its importance in C#. Examples with explanation will be provided to better understand this topic. ‘do while’ loop in C# The do-while loop is another type of loop in C#. It’s similar to the while loop, however the block of code will be... » read more

C# while Loop

In this lesson, you will learn about the “While” Loop control statement in C# and how to use it. Also, a brief explanation of nested While loop will be provided at the end of the lesson. What is the “while” Loop in C#? The “while” loop continually executes a block of code repeatedly until an... » read more

C# ‘for’ Loop

In this lesson, you will learn about the “for” loop, how to use it, and its advantage. You will also learn how to exit a loop, and the nested ‘for’ loops. What is the “For” Loop in C#? There are many situations when you need to execute a block of statements several number of times... » read more

C# switch statement

A switch statement is used to check a variable value against list of other values. The values are called cases, and can be of any datatype. Switch Statement are useful in programming when you want to make a decision based on a variable value. It’s easier than using ‘If’ statement for larger set of values... » read more

C# if statement

The ‘if’ Statement is one of the most used decision-making statement in programming. Whenever you need to test a condition; the ‘if’ statement can be used. The ‘if’ statement checks if a statement true or false and route the program based on the result of that statement. ‘if’ statement Flowchart Syntax of ‘if statement’  ... » read more

C# Keywords

C#, just like other languages, contains reserved words. These words are called keywords. Keywords have meaning to the compiler and cannot be used as variable, class, or any other object in the program. Keywords in C# are categories as the following: Modifier keywords: Modifier keywords are keywords that can modify type and type members. They... » read more

C# Operators

Operates are symbols that tell the compiler to perform a mathematical or logical operation. There are used to manipulate a variable or constant. And easy form of operator is the “+” operator, which tells to add a value to a variable. Operators example int x = 3; x = x + 1; Where x is... » read more

C# Namespace

A namespace is a C# elements that is used to organized your program and separate the codes. Namespace can contain classes, variable, methods, properties, etc. the main usage of namespace is to avoid conflict between classes that have a similar name. It also provides way to put related object under one name space. Example: the... » read more

C# Variables

A variable is a name given to a memory space that the program will use and manipulate. The variable should have a data type, depending on what we want to store in it, and the size of data that can hold. Define a Variables In C#, we define a variable as the following:  <DataType> VariableName; ... » read more

C# Data Types

Data types are everywhere in programming. They are used to define the type of variable declared in a program. In C#, there are three types of data types:  The value types.  The reference type (Object, dynamic, and string type) Pointer data type.  We will discuss how to define, assign, and manipulate variables in the next chapter.... » read more

C# Hello World!

It’s has became a tradition to start the first programming language lesson with the famous “Hello World!” program. The program simply prints the string “Hello world” in the output window. To get started, open visual studio, select new, C# Program. using System; namespace myfirstCSharpProgram { class HelloWorld { static void Main(string[] args) { Console.WriteLine("Hello world!");... » read more

C# Prerequisites

As mentioned earlier, C# programming is very much similar to C, C++ and Java. Having basic of these languages would help you to get along with C# without much difficulty. It also helps to have basic knowledge of Object Oriented fundamentals. Software requirement IDE (Integrated Development Environment), you can install the Microsoft visual studio community... » read more

Introduction to C#

What is C#? C# is a popular programming language that was introduced by Microsoft in late 2000. It had its first stable release in year of 2002. The name of the language is pronounced “C Sharp”. It’s an object oriented language that was designed to be simple, easy to implement, and have close concept to... » read more