C Sharp Call By Reference

C# Call By Reference To pass an argument as reference-type instead of the copy of the original value, i.e, to pass a reference of arguments to the function the ref keyword is used in C#. In the Function Call by Reference method of C#, the permanent changes are made in passed values which also modifies … Read more

Categories C#

C Sharp Call By Value

C# Call By Value Instead of a reference, when a copy of the original value is passed to the function, then it is known as Call by value in C#. The original value is thus neither modified, nor any change in the passed value will alter the actual value. Example: using System; namespace Func_Example { … Read more

Categories C#

C Sharp Function

C# Function A block of code with a signature that is used to execute the specified statements is called a function in C#. Components of a Function: Function name: It is used to specify a unique name to be used for calling a Function. Return type: It is used to define the data type of … Read more

Categories C#

C Sharp Comments

C# Comments The statements that the compiler does not execute are called the Comments in C#. It is mostly used to give a short explanation of a part of the code or for a variable, a method or a class. It is also sometimes used to hide the program code. In C#, we can use … Read more

Categories C#

C Sharp Goto Statement

C# Goto Statement To transfer the control to a specific part of the code from a deeply nested loop or a switch case label, the C# goto statement is used. It is also known as a jump statement because it jumps to a particular label unconditionally. The Goto statement, however, makes a program complex and … Read more

Categories C#

C Sharp Continue Statement

C# Continue Statement To continue the loop or the current flow of the program and to skip the remaining code at the given condition, the C# continue statement is used. When used inside an inner loop, it continues the inner loop only. Syntax: jump-statement; continue; Example: using System; public class Example { public static void … Read more

Categories C#

C Sharp Break Statement

C# Break Statement To break a loop or the current flow of the program at a specified condition or to switch statements, the C# break statement is used. If used inside an inner loop, it breaks the inner loop only. Syntax: jump-statement; break; Example: using System; public class Example { public static void Main(string[] args) … Read more

Categories C#

C Sharp Do While Loop

C# Do-While Loop To iterate a specified code for multiple times, the C# Do-While loop is used. It is recommended to use the Do-While loop when the number of iterations is not fixed and the loop needs to be executed at least once. The loop is executed at least once because, in C# do-while loop, … Read more

Categories C#

C Sharp While Loop

C# While Loop To iterate a specified code for multiple times, the C# While loop is used. It is recommended to use the While loop when the number of iterations is not fixed. The syntax and behavior of C# While loop are the same as that in C or C++. Syntax: while(condition) { //code to … Read more

Categories C#

C Sharp For Loop

C# For Loop To iterate a specified code for multiple times, the C# for loop is used. It is recommended to use the For loop when the number of iterations is fixed. The syntax and behavior of C# for loop are the same as that in C or C++; the variable is firstly initialized, the … Read more

Categories C#