C# Program for Pass by Value

This article shows the use of pass by value in C#. You may go through the following theory on pass by value in C#, click the link below. C# pass by value The program has a variable num value which is passed to the method square() as an argument. This calculates and displays the results … Read more

C# Program to check whether a Number is Even or Odd

This article of C# Program checks if a given integer is Odd or Even, we have used the Ternary Operator (?:) and also seen the use of try and catch block. Explanation:The user enters the number that needs to be check for odd or even numbers. Here the entered number is checked with i % … Read more

C# Program to Swap Two Numbers

In this tutorial, we will write a program to swap two numbers in C#. We will use a temporary variable to swap the numbers along with a user-defined function. Question:Write a C# program to Swap two Numbers using third variable. Explanation:The user input values are passed as an argument in SwapValue function where they are … Read more

C# Program to find the Sum of Digits of a Number

In this tutorial, we will write a C# program to get a number and display the sum of the digits. We will see the use of a do-while loop and get the user inputs with source code. Explanation: The program takes a number from the user as input and passes that number to a function … Read more

C# Program to display the Date in various Formats

In this tutorial, we will write a C# program to display date formats, you see the list of various ways in which you can display dates in C#. A new date object is created for DateTime class in C#. DateTime class is already defined class present in C# language. We do not have to create … Read more

Example Program for Access Modifiers in C#

This tutorial demonstrates the use of Access Specifiers in C# shows the accessing of different specifiers present in C# with source code. You may go through the theory of access modifiers in C#. C# Access Specifiers Question:Write a C# program to Illustrate the Use of Access Specifiers Example Program for Access Modifiers in C# Source … Read more

C# Program for Left Shift Operator Operation

This article shows the use of the left Shift operator in a program in C#. You need to have the knowledge of the following before you go ahead. C# operator The Left Shift Operator in C# allows the creators to shift the bits to their left for the adjustments. The position it needs to shift … Read more

C# Program using Polymorphism

In this tutorial, you will write Polymorphism programs in C#. The program demonstrates for three different data types. Question:Write a C# Program to illustrate the use of Polymorphism. Solution:In the following program, we create an object for Polymorphism Class, and under this Class, we create three functions of the same name print but varying in … Read more

C# program for Multilevel Inheritance

Let us see the source code for C# multilevel inheritance program. You may go through the theory first by clicking the link below. C# Inheritance Explanation: In the following program, Class B inherits A Class C inherits B through which Class C can inherit the property of class A. So, only by creating a single … Read more

C# program for Single Inheritance

Let us see the source code for the Single Inheritance program in C#. You may go through the theory of inheritance first. C# Inheritance Explanation: Inheritance in OOP means to derive some property of another Class. The following program Class B inherits Class A. Now, by only creating an object for Class B, you can … Read more