.
NET Framework
.NET is a framework to develop software applications. It is designed and developed by
Microsoft and the first beta version released in 2000.
It is used to develop applications for web, Windows, phone. Moreover, it provides a
broad range of functionalities and support.
This framework contains a large number of class libraries known as Framework Class
Library (FCL). The software programs written in .NET are executed in the execution
environment, which is called CLR (Common Language Runtime). These are the core
and essential parts of the .NET framework.
This framework provides various services like memory management, networking,
security, memory management, and type-safety.
The .Net Framework supports more than 60 programming languages such as C#, F#,
VB.NET, J#, VC++, JScript.NET, APL, COBOL, Perl, Oberon, ML, Pascal, Eiffel, Smalltalk,
Python, Cobra, ADA, etc.
Following is the .NET framework Stack that shows the modules and components of the
Framework.
The .NET Framework is composed of four main components:
1. Common Language Runtime (CLR)
2. Framework Class Library (FCL),
3. Core Languages (WinForms, ASP.NET, and ADO.NET), and
4. Other Modules (WCF, WPF, WF, Card Space, LINQ, Entity Framework, Parallel
LINQ, Task Parallel Library, etc.)
CLR (Common Language Runtime)
It is a program execution engine that loads and executes the program. It converts the
program into native code. It acts as an interface between the framework and operating
system. It does exception handling, memory management, and garbage collection.
Moreover, it provides security, type-safety, interoperability, and portablility. A list of
CLR components are given below:
FCL (Framework Class Library)
It is a standard library that is a collection of thousands of classes and used to build an
application. The BCL (Base Class Library) is the core of the FCL and provides basic
functionalities.
ASP.NET
ASP.NET is a web framework designed and developed by Microsoft. It is used to
develop websites, web applications, and web services. It provides a fantastic
integration of HTML, CSS, and JavaScript. It was first released in January 2002.
ADO.NET
ADO.NET is a module of .Net Framework, which is used to establish a connection
between application and data sources. Data sources can be such as SQL Server and
XML. ADO .NET consists of classes that can be used to connect, retrieve, insert, and
delete data.
C# Tutorial
C# is a programming language of .Net Framework.
Our C# tutorial includes all topics of C# such as first example, control statements,
objects and classes, inheritance, constructor, destructor, this, static, sealed,
polymorphism, abstraction, abstract class, interface, namespace, encapsulation,
properties, indexer, arrays, strings, regex, exception handling, multithreading, File IO,
Collections etc.
What is C#
C# is pronounced as "C-Sharp". It is an object-oriented programming language
provided by Microsoft that runs on .Net Framework.
By the help of C# programming language, we can develop different types of secured
and robust applications:
o Window applications
o Web applications
o Distributed applications
o Web service applications
o Database applications etc.
C# is approved as a standard by ECMA and ISO. C# is designed for CLI (Common
Language Infrastructure). CLI is a specification that describes executable code and
runtime environment.
C# programming language is influenced by C++, Java, Eiffel, Modula-3, Pascal etc.
languages.
Java vs C#
There are many differences and similarities between Java and C#. A list of top
differences between Java and C# are given below:
No. Java C#
1) Java is a high level, robust, secured and object- C# is an object-oriented
oriented programming language developed by programming language developed by
Oracle. Microsoft that runs on .Net Framework.
2) Java programming language is designed to be C# programming language is designed to be
run on a Java platform, by the help of Java run on the Common Language Runtime
Runtime Environment (JRE). (CLR).
3) Java type safety is safe. C# type safety is unsafe.
4) In java, built-in data types that are passed by In C#, built-in data types that are passed by
value are called primitive types. value are called simple types.
5) Arrays in Java are direct specialization of Object. Arrays in C# are specialization of System.
6) Java does not support conditional compilation. C# supports conditional compilation using
preprocessor directives.
7) Java doesn't support goto statement. C# supports goto statement.
8) Java doesn't support structures and unions. C# supports structures and unions.
9) Java supports checked exception and unchecked C# supports unchecked exception.
exception.
C# History
History of C# language is interesting to know. Here we are going to discuss brief
history of C# language.
C# is pronounced as "C-Sharp". It is an object-oriented programming language
provided by Microsoft that runs on .Net Framework.
Anders Hejlsberg is known as the founder of C# language.
It is based on C++ and Java, but it has many additional extensions used to perform
component oriented programming approach.
C# has evolved much since their first release in the year 2002. It was introduced
with .NET Framework 1.0 and the current version of C# is 5.0.
Let's see the important features introduced in each version of C# are given below.
C# Features
C# is object oriented programming language. It provides a lot of features that are
given below.
1. Simple
2. Modern programming language
3. Object oriented
4. Type safe
5. Interoperability
6. Scalable and Updateable
7. Component oriented
8. Structured programming language
9. Rich Library
10. Fast speed
1) Simple
C# is a simple language in the sense that it provides structured approach (to break the
problem into parts), rich set of library functions, data types etc.
2) Modern Programming Language
C# programming is based upon the current trend and it is very powerful and simple
for building scalable, interoperable and robust applications.
3) Object Oriented
C# is object oriented programming language. OOPs makes development and
maintenance easier where as in Procedure-oriented programming language it is not
easy to manage if code grows as project size grow.
4) Type Safe
C# type safe code can only access the memory location that it has permission to
execute. Therefore it improves a security of the program.
5) Interoperability
Interoperability process enables the C# programs to do almost anything that a native
C++ application can do.
6) Scalable and Updateable
C# is automatic scalable and updateable programming language. For updating our
application we delete the old files and update them with new ones.
7) Component Oriented
C# is component oriented programming language. It is the predominant software
development methodology used to develop more robust and highly scalable
applications.
8) Structured Programming Language
C# is a structured programming language in the sense that we can break the program
into parts using functions. So, it is easy to understand and modify.
9) Rich Library
C# provides a lot of inbuilt functions that makes the development fast.
10) Fast Speed
The compilation and execution time of C# language is fast.
C# Example: Hello World
In C# programming language, a simple "hello world" program can be written by
multiple ways. Let's see the top 4 ways to create a simple C# example:
o Simple Example
o Using System
o Using public modifier
o Using namespace
C# Simple Example
1. class Program
2. {
3. static void Main(string[] args)
4. {
5. System.Console.WriteLine("Hello World!");
6. }
7. }
Output:
Hello World!
Description
class: is a keyword which is used to define class.
Program: is the class name. A class is a blueprint or template from which objects are
created. It can have data members and methods. Here, it has only Main method.
static: is a keyword which means object is not required to access static members. So
it saves memory.
void: is the return type of the method. It does't return any value. In such case, return
statement is not required.
Main: is the method name. It is the entry point for any C# program. Whenever we run
the C# program, Main() method is invoked first before any other method. It represents
start up of the program.
string[] args: is used for command line arguments in C#. While running the C#
program, we can pass values. These values are known as arguments which we can use
in the program.
System.Console.WriteLine("Hello World!"): Here, System is the namespace.
Console is the class defined in System namespace. The WriteLine() is the static method
of Console class which is used to write the text on the console.
C# Example: Using System
If we write using System before the class, it means we don't need to specify System
namespace for accessing any class of this namespace. Here, we are using Console class
without specifying System.Console.
1. using System;
2. class Program
3. {
4. static void Main(string[] args)
5. {
6. Console.WriteLine("Hello World!");
7. }
8. }
Output:
Hello World!
C# Example: Using public modifier
We can also specify public modifier before class and Main() method. Now, it can be
accessed from outside the class also.
1. using System;
2. public class Program
3. {
4. public static void Main(string[] args)
5. {
6. Console.WriteLine("Hello World!");
7. }
8. }
Output:
Hello World!
C# Example: Using namespace
We can create classes inside the namespace. It is used to group related classes. It is
used to categorize classes so that it can be easy to maintain.
1. using System;
2. namespace ConsoleApplication1
3. {
4. public class Program
5. {
6. public static void Main(string[] args)
7. {
8. Console.WriteLine("Hello World!");
9. }
10. }
11. }
Output:
Hello World!
Simple programs on c#:
1.Addition of Two Numbers
using System;
class Addition
static void Main()
int num1 = 5;
int num2 = 10;
int sum = num1 + num2;
Console.WriteLine($"The sum of {num1} and {num2} is {sum}");
2.Even or Odd
using System;
class EvenOrOdd
static void Main()
Console.WriteLine("Enter a number:");
int num = Convert.ToInt32(Console.ReadLine());
if (num % 2 == 0)
Console.WriteLine($"{num} is even.");
else
{
Console.WriteLine($"{num} is odd.");
3. Find the Largest Number
using System;
class LargestNumber
static void Main()
Console.WriteLine("Enter three numbers:");
int num1 = Convert.ToInt32(Console.ReadLine());
int num2 = Convert.ToInt32(Console.ReadLine());
int num3 = Convert.ToInt32(Console.ReadLine());
int largest = num1;
if (num2 > largest)
largest = num2;
if (num3 > largest)
largest = num3;
Console.WriteLine($"The largest number is {largest}");
}
}
4. User Input
using System;
class UserInput
{
static void Main()
{
Console.WriteLine("Enter your name:");
string name = Console.ReadLine();
Console.WriteLine($"Hello, {name}!");
}
}
C# Variable
A variable is a name of memory location. It is used to store data. Its value can be changed
and it can be reused many times.
It is a way to represent memory location through symbol so that it can be easily identified.
The basic variable type available in C# can be categorized as:
Variable Type Example
Decimal types decimal
Boolean types True or false value, as assigned
Integral types int, char, byte, short, long
Floating point types float and double
Nullable types Nullable data types
Let's see the syntax to declare a variable:
1. type variable_list;
The example of declaring variable is given below:
1. int i, j;
2. double d;
3. float f;
4. char ch;
Here, i, j, d, f, ch are variables and int, double, float, char are data types.
We can also provide values while declaring the variables as given below:
1. int i=2,j=4; //declaring 2 variable of integer type
2. float f=40.2;
3. char ch='B';
Rules for defining variables
A variable can have alphabets, digits and underscore.
A variable name can start with alphabet and underscore only. It can't start with digit.
No white space is allowed within variable name.
A variable name must not be any reserved word or keyword e.g. char, float etc.
Valid variable names:
1. int x;
2. int _x;
3. int k20;
Invalid variable names:
1. int 4;
2. int x y;
3. int double;
C# Data Types
A data type specifies the type of data that a variable can store such as integer, floating,
character etc.
There are 3 types of data types in C# language.
Types Data Types
Value Data Type short, int, char, float, double etc
Reference Data Type String, Class, Object and Interface
Pointer Data Type Pointers
Value Data Type
The value data types are integer-based and floating-point based. C# language
supports both signed and unsigned literals.
There are 2 types of value data type in C# language.
1) Predefined Data Types - such as Integer, Boolean, Float, etc.
2) User defined Data Types - such as Structure, Enumerations, etc.
The memory size of data types may change according to 32 or 64 bit operating system.
Let's see the value data types. It size is given according to 32 bit OS.
Data Memory Size Range
Types
char 1 byte -128 to 127
signed char 1 byte -128 to 127
unsigned 1 byte 0 to 127
char
short 2 byte -32,768 to 32,767
signed short 2 byte -32,768 to 32,767
unsigned 2 byte 0 to 65,535
short
int 4 byte -2,147,483,648 to -2,147,483,647
signed int 4 byte -2,147,483,648 to -2,147,483,647
unsigned int 4 byte 0 to 4,294,967,295
long 8 byte ?9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
signed long 8 byte ?9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned 8 byte 0 - 18,446,744,073,709,551,615
long
float 4 byte 1.5 * 10-45 - 3.4 * 1038, 7-digit precision
double 8 byte 5.0 * 10-324 - 1.7 * 10308, 15-digit precision
decimal 16 byte at least -7.9 * 10?28 - 7.9 * 1028, with at least 28-digit precision
Reference Data Type
The reference data types do not contain the actual data stored in a variable, but they
contain a reference to the variables.
If the data is changed by one of the variables, the other variable automatically reflects
this change in value.
There are 2 types of reference data type in C# language.
1) Predefined Types - such as Objects, String.
2) User defined Types - such as Classes, Interface.
Pointer Data Type
The pointer in C# language is a variable, it is also known as locator or indicator that
points to an address of a value.
Symbols used in pointer
Symbol Name Description
& (ampersand sign) Address operator Determine the address of a variable.
* (asterisk sign) Indirection operator Access the value of an address.
Declaring a pointer
The pointer in C# language can be declared using * (asterisk symbol).
1. int * a; //pointer to int
2. char * c; //pointer to char
1. Integer Data Type
using System;
class IntegerExample
{
static void Main()
{
int a = 10;
int b = 20;
int sum = a + b;
int difference = a - b;
int product = a * b;
int quotient = a / b;
Console.WriteLine($"a: {a}, b: {b}");
Console.WriteLine($"Sum: {sum}");
Console.WriteLine($"Difference: {difference}");
Console.WriteLine($"Product: {product}");
Console.WriteLine($"Quotient: {quotient}");
}
}
2. Float Data Type
using System;
class FloatExample
static void Main()
float a = 10.5f;
float b = 20.3f;
float sum = a + b;
float difference = a - b;
float product = a * b;
float quotient = a / b;
Console.WriteLine($"a: {a}, b: {b}");
Console.WriteLine($"Sum: {sum}");
Console.WriteLine($"Difference: {difference}");
Console.WriteLine($"Product: {product}");
Console.WriteLine($"Quotient: {quotient}");
3. Double Data Type
using System;
class DoubleExample
static void Main()
double a = 10.5;
double b = 20.3;
double sum = a + b;
double difference = a - b;
double product = a * b;
double quotient = a / b;
Console.WriteLine($"a: {a}, b: {b}");
Console.WriteLine($"Sum: {sum}");
Console.WriteLine($"Difference: {difference}");
Console.WriteLine($"Product: {product}");
Console.WriteLine($"Quotient: {quotient}");
4. Boolean Data Type
using System;
class BooleanExample
static void Main()
bool isTrue = true;
bool isFalse = false;
Console.WriteLine($"isTrue: {isTrue}");
Console.WriteLine($"isFalse: {isFalse}");
bool result = (5 > 3) && (10 < 20);
Console.WriteLine($"(5 > 3) && (10 < 20): {result}");
5. Character Data Type
using System;
class CharExample
static void Main()
char letter = 'A';
char digit = '1';
char symbol = '$';
Console.WriteLine($"letter: {letter}");
Console.WriteLine($"digit: {digit}");
Console.WriteLine($"symbol: {symbol}");
6. String Data Type
using System;
class StringExample
static void Main()
string firstName = "John";
string lastName = "Doe";
string fullName = firstName + " " + lastName;
Console.WriteLine($"First Name: {firstName}");
Console.WriteLine($"Last Name: {lastName}");
Console.WriteLine($"Full Name: {fullName}");
Console.WriteLine($"Full Name in Upper Case: {fullName.ToUpper()}");
Console.WriteLine($"Full Name in Lower Case: {fullName.ToLower()}");
7. Array Data Type
using System;
class ArrayExample
static void Main()
int[] numbers = { 1, 2, 3, 4, 5 };
Console.WriteLine("Array elements:");
foreach (int number in numbers)
Console.WriteLine(number);
Console.WriteLine($"First Element: {numbers[0]}");
Console.WriteLine($"Last Element: {numbers[numbers.Length - 1]}");
C# operators
An operator is simply a symbol that is used to perform operations. There can be many
types of operations like arithmetic, logical, bitwise etc.
There are following types of operators to perform different types of operations in C#
language.
o Arithmetic Operators
o Relational Operators
o Logical Operators
o Bitwise Operators
o Assignment Operators
o Unary Operators
o Ternary Operators
o Misc Operators
Precedence of Operators in C#
The precedence of operator specifies that which operator will be evaluated first and
next. The associativity specifies the operators direction to be evaluated, it may be left
to right or right to left.
Let's understand the precedence by the example given below:
int data= 10+ 5*5
The "data" variable will contain 35 because * (multiplicative operator) is evaluated before +
(additive operator).
The precedence and associativity of C# operators is given below:
Category (By Precedence) Operator(s) Associativity
Unary + - ! ~ ++ -- (type)* & sizeof Right to Left
Additive +- Left to Right
Multiplicative %/* Left to Right
Relational < > <= >= Left to Right
Shift << >> Left to Right
Equality == != Right to Left
Logical AND & Left to Right
Logical OR | Left to Right
Logical XOR ^ Left to Right
Conditional OR || Left to Right
Conditional AND && Left to Right
Null Coalescing ?? Left to Right
Ternary ?: Right to Left
Assignment = *= /= %= += - = <<= >>= &= ^= |= => Right to Left
1. Arithmetic Operators
using System;
class ArithmeticOperators
{
static void Main()
int a = 10;
int b = 5;
Console.WriteLine($"a: {a}, b: {b}");
Console.WriteLine($"Addition: {a + b}");
Console.WriteLine($"Subtraction: {a - b}");
Console.WriteLine($"Multiplication: {a * b}");
Console.WriteLine($"Division: {a / b}");
Console.WriteLine($"Modulus: {a % b}");
2. Relational Operators
A program to demonstrate relational operations.
using System;
class RelationalOperators
static void Main()
int a = 10;
int b = 5;
Console.WriteLine($"a: {a}, b: {b}");
Console.WriteLine($"a == b: {a == b}");
Console.WriteLine($"a != b: {a != b}");
Console.WriteLine($"a > b: {a > b}");
Console.WriteLine($"a < b: {a < b}");
Console.WriteLine($"a >= b: {a >= b}");
Console.WriteLine($"a <= b: {a <= b}");
3. Logical Operators
A program to demonstrate logical operations.
using System;
class LogicalOperators
static void Main()
bool x = true;
bool y = false;
Console.WriteLine($"x: {x}, y: {y}");
Console.WriteLine($"x && y: {x && y}");
Console.WriteLine($"x || y: {x || y}");
Console.WriteLine($"!x: {!x}");
Console.WriteLine($"!y: {!y}");
4.Bitwise Operators
A program to demonstrate basic bitwise operations.
using System;
class BitwiseOperators
static void Main()
int a = 60; // 60 = 0011 1100
int b = 13; // 13 = 0000 1101
int result;
// Bitwise AND
result = a & b; // 12 = 0000 1100
Console.WriteLine($"a & b = {result}");
// Bitwise OR
result = a | b; // 61 = 0011 1101
Console.WriteLine($"a | b = {result}");
// Bitwise XOR
result = a ^ b; // 49 = 0011 0001
Console.WriteLine($"a ^ b = {result}");
// Bitwise NOT
result = ~a; // -61 = 1100 0011 (in 32-bit: 1111 1111 1111 1111 1111 1111 1100 0011)
Console.WriteLine($"~a = {result}");
// Left shift
result = a << 2; // 240 = 1111 0000
Console.WriteLine($"a << 2 = {result}");
// Right shift
result = a >> 2; // 15 = 0000 1111
Console.WriteLine($"a >> 2 = {result}");
5.Assignment Operators
using System;
class BasicAssignment
static void Main()
int a = 10; // Assigns the value 10 to variable a
Console.WriteLine($"a = {a}");
Bitwise AND Assignment Operator
using System;
class BitwiseAndAssignment
static void Main()
int a = 10; // 10 = 1010 in binary
a &= 5; // Equivalent to a = a & 5 (5 = 0101 in binary -> 1010 & 0101 = 0000)
Console.WriteLine($"a &= 5 -> a = {a}");
Bitwise OR Assignment Operator
using System;
class BitwiseOrAssignment
{
static void Main()
int a = 10; // 10 = 1010 in binary
a |= 5; // Equivalent to a = a | 5 (5 = 0101 in binary -> 1010 | 0101 = 1111)
Console.WriteLine($"a |= 5 -> a = {a}");
Bitwise XOR Assignment Operator
using System;
class BitwiseXorAssignment
static void Main()
int a = 10; // 10 = 1010 in binary
a ^= 5; // Equivalent to a = a ^ 5 (5 = 0101 in binary -> 1010 ^ 0101 = 1111)
Console.WriteLine($"a ^= 5 -> a = {a}");
Left Shift Assignment Operator
using System;
class LeftShiftAssignment
static void Main()
int a = 10; // 10 = 1010 in binary
a <<= 2; // Equivalent to a = a << 2 (1010 << 2 = 101000)
Console.WriteLine($"a <<= 2 -> a = {a}");
}
}
Right Shift Assignment Operator
using System;
class RightShiftAssignment
static void Main()
int a = 10; // 10 = 1010 in binary
a >>= 2; // Equivalent to a = a >> 2 (1010 >> 2 = 10)
Console.WriteLine($"a >>= 2 -> a = {a}");
6.Unary Operators
using System;
class UnaryOperators
static void Main()
// Unary plus and minus
int a = 10;
int b = -a; // Unary minus
int c = +b; // Unary plus
Console.WriteLine("Unary plus and minus:");
Console.WriteLine($"a: {a}");
Console.WriteLine($"-a: {b}");
Console.WriteLine($"+b: {c}");
// Increment operators
int d = 5;
int e = d++; // Post-increment
int f = ++d; // Pre-increment
Console.WriteLine("\nIncrement operators:");
Console.WriteLine($"d: {d}");
Console.WriteLine($"Post-increment (d++): e = {e}, d after increment = {d}");
Console.WriteLine($"Pre-increment (++d): f = {f}, d after increment = {d}");
// Decrement operators
int g = 5;
int h = g--; // Post-decrement
int i = --g; // Pre-decrement
Console.WriteLine("\nDecrement operators:");
Console.WriteLine($"g: {g}");
Console.WriteLine($"Post-decrement (g--): h = {h}, g after decrement = {g}");
Console.WriteLine($"Pre-decrement (--g): i = {i}, g after decrement = {g}");
// Logical NOT
bool flag = true;
Console.WriteLine("\nLogical NOT:");
Console.WriteLine($"flag: {flag}");
Console.WriteLine($"!flag: {!flag}");
// Bitwise NOT
int j = 10; // 10 = 0000 1010 in binary
Console.WriteLine("\nBitwise NOT:");
Console.WriteLine($"j: {j}");
Console.WriteLine($"~j: {~j}");
// Unary cast
double k = 10.5;
int l = (int)k; // Casting double to int
Console.WriteLine("\nUnary cast:");
Console.WriteLine($"k: {k}");
Console.WriteLine($"(int)k: {l}");
Explanation:
1. Unary Plus and Minus: Demonstrates the unary plus (+) and minus (-) operators.
2. Increment Operators: Demonstrates post-increment (d++) and pre-increment (++d)
operators.
3. Decrement Operators: Demonstrates post-decrement (g--) and pre-decrement (--g)
operators.
4. Logical NOT: Demonstrates the logical NOT operator (!).
5. Bitwise NOT: Demonstrates the bitwise NOT operator (~).
6. Unary Cast: Demonstrates casting a double to an int using the unary cast operator ((int)).
7. Ternary Operators
Basic Ternary Operator
using System;
class BasicTernaryOperator
static void Main()
int a = 10;
int b = 20;
// Using ternary operator to determine the larger number
int max = (a > b) ? a : b;
Console.WriteLine($"a: {a}, b: {b}");
Console.WriteLine($"The larger number is: {max}");
Ternary Operator for Even or Odd
using System;
class EvenOrOdd
static void Main()
int number = 7;
// Using ternary operator to check if the number is even or odd
string result = (number % 2 == 0) ? "Even" : "Odd";
Console.WriteLine($"Number: {number}");
Console.WriteLine($"The number is: {result}");
Ternary Operator for Checking Eligibility
using System;
class VotingEligibility
{
static void Main()
{
int age = 18;
// Using ternary operator to check if the person is eligible to vote
string result = (age >= 18) ? "Eligible to vote" : "Not eligible to vote";
Console.WriteLine($"Age: {age}");
Console.WriteLine($"Voting status: {result}");
}
}
Ternary Operator for Checking Pass/Fail
using System;
class PassOrFail
{
static void Main()
{
int marks = 75;
// Using ternary operator to check if the student has passed or failed
string result = (marks >= 50) ? "Pass" : "Fail";
Console.WriteLine($"Marks: {marks}");
Console.WriteLine($"Result: {result}");
}
}
Null colising in c#
In C#, the null-coalescing operator (??) provides a concise way to handle situations where you
want to assign a default value when a nullable type or reference type is null. It is particularly
useful for simplifying null checks and providing default values in assignments. Here's how it
works:
Syntax:
expression1 ?? expression2
using System;
class Program
{
static void Main()
{
int? nullableInt = null;
int nonNullableInt = nullableInt ?? 0;
Console.WriteLine($"nullableInt: {nullableInt}");
Console.WriteLine($"nonNullableInt: {nonNullableInt}");
}
}
C# Keywords
A keyword is a reserved word. You cannot use it as a variable name, constant name etc.
In C# keywords cannot be used as identifiers. However, if we want to use the keywords as
identifiers, we may prefix the keyword with @ character.
A list of Reserved Keywords available in C# programming language is given
below:
<td< td=""></td<>
abstract base as bool break catch case
byte char checked class const continue decimal
private protected public return readonly ref sbyte
explicit extern false finally fixed float for
foreach goto if implicit in in (generic int
modifier)
ulong ushort unchecked using unsafe virtual void
null object operator out out (generic override params
modifier)
default delegate do double else enum event
sealed short sizeof stackalloc static string struct
switch this throw true try typeof uint
abstract base as bool break catch case
volatile while