0% found this document useful (0 votes)
49 views42 pages

Unit II - Introduction To C#

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views42 pages

Unit II - Introduction To C#

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

GOODWILL CHRISTIAN COLLEGE FOR WOMEN

C# AND DOT NET


FRAMEWORK
UNIT 2 INTRODUCTION TO C#
KAVITHA RAJALAKSHMI D
KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Introduction
C# is an object-oriented programming language developed by Microsoft by Anders Hejlsberg
and his team.

Main features of C#
1. Simple
Most of the confusing and complicated things are removed in C#, such as there is no
usage of scope resolution operator "::" or "->" operators. Unsafe operations such as direct
memory manipulation are not allowed. There is no need to handle memory explicitly. It
supports automatic memory management and garbage collection. Next important change
is that, "= =" is used for comparison operation and "=" is used for assignment operation.
assignment operation (=) cannot be used in "if" or “while” statement. If you use, It will
give compile time error.
2. Object oriented
C# supports all features of object oriented language such as class, object, Data
Encapsulation, inheritance, polymorphism, interfaces.
3. Type safe
Pointers are not directly supported by .NET. C# - Types are safe. Type-safe code
accesses only the memory locations it is authorized to access.
Example:
string empName = 10; //cause an error
int a = "Hello World"; // cause an error
double db = d; //cause an error
All of the above code will give compile time error.
While accessing the array, C# checks the range and warned if it goes out-of-bounds.
4. Interoperability
C# includes native support for the COM and windows based applications.We can easily
access the Components (dll) from VB. NET and other managed code languages using C#
and vice versa.
5. Scalable and updateable
We can upgrade code of an existing running application by using the new version of dll.
There is no registering of dynamic linking library.

Application of C#

C# language can be used with variety of applications

1. Web application
2. Windows application
3. Web services
4. Windows services
5. Mobile application
6. Developing component library

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 1


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Getting Started with C# program

Let us directly jump on our simple example that will display “Welcome at C# Tutorial” on
the console.

using System; // Namespace Declaration

namespace ConsoleApplication1

class Program

// program starts with a call to Main() function.

static void Main(string[] args)

Console.WriteLine("Welcome at C# Tutorial ");

System.Console.ReadLine();

Compile the above program; it will create the ConsoleApplication1.exe file.

C# program starts with namespaces. Namespaces are the logical grouping of related types.
Console class is available in System namespace. It is not compulsory to use name space, but
at this situation you have to append the related namespace with every types.

Example:

System.Text.StringBuilder sb = new System.Text.StringBuilder();

System.Console.ReadLine(); // fully qualified name.

As you can see, the code is lengthy; therefore it would be nice if you write required
namespaces at the beginning of program.

In C# code must be contained within a class, so when you create a new console application in
Visual Studio, the template will be created automatically that have a class and main function
is written.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 2


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Important: C # is a case-sensitive language.

For writing text on console window, there are two static methods of Console class Write()
and WriteLine().

Console.ReadLine() reads user input. ReadLine() is also an static method and return type is
strings. If you execute the console application without writing the Console.ReadLine(), then
console window will disappear in seconds and you will not able to see the output. It forces
the application to wait for some input from keyboard before the application exits.

Variables in C#

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:

type variable_list;

The example of declaring variable is given below:

int i, j;

double d;

float f;

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:

int i=2,j=4; //declaring 2 variable of integer type

float f=40.2;

char ch='B';

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 3


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

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.

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.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 4


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Let's see the value data types. It size is given according to 32 bit OS.

Memory
Data Types Range
Size

char 1 byte -128 to 127

signed char 1 byte -128 to 127

unsigned char 1 byte 0 to 127

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 long 8 byte 0 - 18,446,744,073,709,551,615

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

at least -7.9 * 10?28 - 7.9 * 1028, with at least 28-digit


decimal 16 byte
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.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 5


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

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).

int * a; //pointer to int

char * c; //pointer to char

Boxing and Unboxing

Boxing and unboxing is an important concept in .NET framework. Boxing and unboxing
enables you to convert value type into reference type and vice versa.

Boxing: Converting a value type to reference type is called as Boxing. It is implicit


conversion.

Example

int intVar = 10; // intVar is a value type

object obj = intVar; // intVar is boxed

System.Console.WriteLine(intVar.ToString());

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 6


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Unboxing: Converting a reference type into value type is called unboxing. It is an explicit
operation.

Example

using System.Collections;

ArrayList list = new ArrayList(); // list is a reference type

int intVar = 10; // intVar is a value type

list.Add(intVar); // intVar is boxed

intVar = (int)list[0]; // list[0] is unboxed

System.Console.WriteLine(intVar.ToString());

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.

 Arithmetic Operators
 Relational Operators
 Logical Operators
 Bitwise Operators
 Assignment Operators
 Unary Operators
 Ternary Operators
 Misc Operators

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 7


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

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

C# Literals

The fixed values are called as Literal. Literal is a value that is used by the variables. Values
can be either an integer, float or string, etc.

// Here 100 is a constant/literal.

int x = 100;

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 8


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Literals can be of the following types:

 Integer Literals
 Floating-point Literals
 Character Literals
 String Literals
 Null Literals
 Boolean Literals

Integer Literals:

A literal of integer type is known as the integer literal. It can be octal, decimal, binary, or
hexadecimal constant. No prefix is required for the decimal numbers. A suffix can also be
used with the integer literals like U or u are used for unsigned numbers while l or L are used
for long numbers. By default, every literal is of int type. For Integral data types (byte, short,
int, long), we can specify literals in the ways:

1. Decimal literals (Base 10): In this form, the allowed digits are 0-9.
int x = 101;
2. Octal literals (Base 8): In this form, the allowed digits are 0-7.
// The octal number should be prefix with 0.
int x = 0146;
3. Hexa-decimal literals (Base 16): In this form, the allowed digits are 0-9 and
characters are a-f. We can use both uppercase and lowercase characters. As we know
that c# is a case-sensitive programming language but here c# is not case-sensitive.
// The hexa-decimal number should be prefix with 0X or 0x.
int x = 0X123Face;
4. Binary literals (Base 2): In this form, the allowed digits are only 1’s and 0’s.
// The binary number should be prefix with 0b.
int x = 0b101

Floating-point Literals:

The literal which has an integer part, a decimal point, a fractional part, and an exponent part
is known as the floating-point literal. These can be represented either in decimal form or
exponential form.

Examples:

Double d = 3.14145 // Valid

Double d = 312569E-5 // Valid

Double d = 125E // invalid: Incomplete exponent

Double d = 784f // valid

Double d = .e45 // invalid: missing integer or fraction

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 9


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Character Literals: For character data types we can specify literals in 3 ways:

 Single quote: We can specify literal to char data type as single character within single
quote. Example : char ch = 'a';
 Unicode Representation: We can specify char literals in Unicode representation
‘\uxxxx’. Here xxxx represents 4 hexadecimal numbers.
char ch = '\u0061'; // Here /u0061 represent a.
 Escape Sequence: Every escape character can be specified as char literals.
char ch = '\n';

Escape Sequence Meaning

\\ \ character

\’ ‘ character

\? ? character

\” ” character

\b Backspace

\a Alert or Bell

\n New Line

\f Form Feed

\r Carriage Return

\v Vertical Tab

\xhh… Hexadecimal number of one or more digits

String Literals:
Literals which are enclosed in double quotes(“”) or starts with @”” are known as the String
literals.
Examples:
String s1 = "Hello C# Geeks!";
String s2 = @"Hello C# Geeks!";

Boolean Literals:
Only two values are allowed for Boolean literals i.e. true and false.

Example:
bool b = true;
bool c = false;

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 10


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Expressions
An expression in C# is a combination of operands (variables, literals, method calls) and
operators that can be evaluated to a single value. To be precise, an expression must have at
least one operand but may not have any operator.
Let's look at the example below:
double temperature;

temperature = 42.05;
Here, 42.05 is an expression. Also, temperature = 42.05 is an expression too.
int a, b, c, sum;
sum = a + b + c;
Here, a + b + c is an expression.
if (age>=18 && age<58)
Console.WriteLine("Eligible to work");
Here, (age>=18 && age<58) is an expression that returns a boolean value. "Eligible to work"
is also an expression.

Enumeration
An enumeration is a set of named integer constants. By default the type of each element in
the enum is integer. It is declared using the enum keyword. By default, the value of the first
enumeration element is 0 and automatically incremented by 1 for successive element.
For creating an enumeration, the general form is
enum name { enumeration list };
enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };
Here Sunday has the value 0, Monday 1 and so on.

You can also assign any arbiter value to enum element.


enum EditMenu
{
Create=10,
Delete=20,
Add=30,
Update=40
};

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 11


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Let us take an example on enumeration. In this example, We have created two enum Days
and EditMenu.
Example
using System;
namespace ConsoleApplication1
{
enum EditMenu

{
Create=10,
Delete=20,
Add=30,
Update=40
};

class Program
{ enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };
static void Main(string[] args)
{
int favDay = (int)Days.Sunday;
Console.WriteLine("My favorite day is {0} = {1}", Days.Sunday,favDay);

Console.WriteLine("The value of enum ADD is = "+(int)EditMenu.Add);


Console.WriteLine("Iterating through an enum \n\n");
foreach (Days d in Enum.GetValues(typeof(Days)))
{
Console.WriteLine(d.ToString());
}

Console.ReadLine();
}
}
}

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 12


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Output:
My favorite day is Sunday = 0
The value of enum ADD is =30
Iterating through an enum

Sunday
Monday
Tuesday
Wednesday
Thursday
Friday

Saturday

C# Control Statements
C# if-else
In C# programming, the if statement is used to test the condition. There are various types of if
statements in C#.

 if statement
 if-else statement
 nested if statement
 if-else-if ladder
C# IF Statement
The C# if statement tests the condition. It is executed if condition is true.
Syntax:
if(condition){

//code to be executed
}
C# If Example
using System;
public class IfExample {
public static void Main(string[] args) {
int num = 10;
if (num % 2 == 0)
GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 13
KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

{
Console.WriteLine("It is even number");
}
}

}
Output:
It is even number

C# IF-else Statement
The C# if-else statement also tests the condition. It executes the if block if condition is true
otherwise else block is executed.
Syntax:
if(condition){
//code if condition is true

}else{
//code if condition is false
}

C# If-else Example
using System;

public class IfExample {


public static void Main(string[] args) {
int num = 11;
if (num % 2 == 0) {
Console.WriteLine("It is even number");
} else {

Console.WriteLine("It is odd number");


}
} }
Output:
It is odd number
GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 14
KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# If-else Example: with input from user


In this example, we are getting input from the user using Console.ReadLine() method. It
returns string. For numeric value, you need to convert it into int using Convert.ToInt32()
method.
using System;
public class IfExample {

public static void Main(string[] args) {


Console.WriteLine("Enter a number:");
int num = Convert.ToInt32(Console.ReadLine());
if (num % 2 == 0) {
Console.WriteLine("It is even number");
} else {
Console.WriteLine("It is odd number");
}
} }

Output: Output:
Enter a number:11 Enter a number:12
It is odd number It is even number

C# IF-else-if ladder Statement


The C# if-else-if ladder statement executes one condition from multiple statements.
Syntax:
if(condition1){
//code to be executed if condition1 is true

}else if(condition2){
//code to be executed if condition2 is true
}
...
else{
//code to be executed if all the conditions are false

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 15


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# If else-if Example
using System;
public class IfExample{
public static void Main(string[] args) {

Console.WriteLine("Enter a number to check grade:");


int num = Convert.ToInt32(Console.ReadLine());
if (num <0 || num >100) {
Console.WriteLine("wrong number");
} else if(num >= 0 && num < 50){
Console.WriteLine("Fail");

} else if (num >= 50 && num < 60) {


Console.WriteLine("D Grade");
} else if (num >= 60 && num < 70){
Console.WriteLine("C Grade");
} else if (num >= 70 && num < 80) {
Console.WriteLine("B Grade");

} else if (num >= 80 && num < 90) {


Console.WriteLine("A Grade");
} else if (num >= 90 && num <= 100) {
Console.WriteLine("A+ Grade");
}
}

Output: Output:
Enter a number to check grade:66 Enter a number to check grade:-2
C Grade wrong number

C# switch
The C# switch statement executes one statement from multiple conditions. It is like if-else-if
ladder statement in C#.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 16


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Syntax:
switch(expression){
case value1:
//code to be executed;

break;
case value2:
//code to be executed;
break;
......
default:

//code to be executed if all cases are not matched;


break;
}

C# Switch Example
using System;

public class SwitchExample{


public static void Main(string[] args) {
Console.WriteLine("Enter a number:");
int num = Convert.ToInt32(Console.ReadLine());
switch (num) {
case 10: Console.WriteLine("It is 10"); break;

case 20: Console.WriteLine("It is 20"); break;


case 30: Console.WriteLine("It is 30"); break;
default: Console.WriteLine("Not 10, 20 or 30"); break;
} } }

Output: Output:
Enter a number: Enter a number:
10 55
It is 10 Not 10, 20 or 30

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 17


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# For Loop
The C# for loop is used to iterate a part of the program several times. If the number of
iteration is fixed, it is recommended to use for loop than while or do-while loops.
The C# for loop is same as C/C++. We can initialize variable, check condition and
increment/decrement value.

Syntax:
for(initialization; condition; incr/decr){
//code to be executed
}

C# For Loop Example


using System;
public class ForExample {
public static void Main(string[] args){
for(int i=1;i<=10;i++){
Console.WriteLine(i);
}
}

Output:
1
2
3
4

5
6
7
8
9
10

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 18


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Nested For Loop


In C#, we can use for loop inside another for loop, it is known as nested for loop. The inner
loop is executed fully when outer loop is executed one time. So if outer loop and inner loop
are executed 3 times, inner loop will be executed 3 times for each outer loop i.e. total 9 times.
Let's see a simple example of nested for loop in C#.
using System;

public class ForExample {


public static void Main(string[] args) {
for(int i=1;i<=3;i++){
for(int j=1;j<=3;j++){
Console.WriteLine(i+" "+j);
}
}
}
}

Output:
11
12

13
21
22
23
31
32

33

C# Infinite For Loop


If we use double semicolon in for loop, it will be executed infinite times. Let's see a simple
example of infinite for loop in C#.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 19


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

using System; Output:


public class ForExample { Infinitive For Loop
public static void Main(string[] args) { Infinitive For Loop
for (; ;) Infinitive For Loop
{ Infinitive For Loop
Console.WriteLine("Infinitive For Loop"); Infinitive For Loop
} ctrl+c
}
}

C# While Loop
In C#, while loop is used to iterate a part of the program several times. If the number of
iteration is not fixed, it is recommended to use while loop than for loop.

Syntax:
while(condition){

//code to be executed
}

C# While Loop Example

using System; Output:


1
public class WhileExample {
2
public static void Main(string[] args) { 3
4
int i=1;
5
while(i<=10) { 6
7
Console.WriteLine(i);
8
i++; 9
10
}
}
}

C# Nested While Loop


In C#, we can use while loop inside another while loop, it is known as nested while loop. The
nested while loop is executed fully when outer loop is executed once.
GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 20
KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

using System; Output:


public class WhileExample {
11
public static void Main(string[] args) { 12
13
int i=1;
21
while(i<=3) { 22
23
int j = 1;
31
while (j <= 3) { 32
33
Console.WriteLine(i+" "+j);
j++;
}
i++;
}
}
}

C# Infinitive While Loop Example:


We can also create infinite while loop by passing true as the test condition.

using System; Output:


public class WhileExample
Infinitive While Loop
{
Infinitive While Loop
public static void Main(string[] args) Infinitive While Loop
{ Infinitive While Loop
Infinitive While Loop
while(true)
ctrl+c
{
Console.WriteLine("Infinitive
While Loop");
}
}
}

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 21


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Do-While Loop
The C# do-while loop is used to iterate a part of the program several times. If the number of
iteration is not fixed and you must have to execute the loop at least once, it is recommended
to use do-while loop.
The C# do-while loop is executed at least once because condition is checked after loop body.
Syntax:

do{
//code to be executed
}while(condition);

C# do-while Loop Example

using System; Output:


public class DoWhileExample {
public static void Main(string[] args) { 1
2
int i = 1;
3
do{ 4
Console.WriteLine(i); 5
i++; 6
} while (i <= 10) ; 7
} 8
} 9
10

C# Nested do-while Loop


In C#, if you use do-while loop inside another do-while loop, it is known as nested do-while
loop. The nested do-while loop is executed fully for each outer do-while loop.

using System; Output:


public class DoWhileExample {
public static void Main(string[] args){ 11
12
int i=1;
13
do{ 21
int j = 1; 22
do{ 23
Console.WriteLine(i+" "+j); 31
j++; 32
} while (j <= 3) ; 33
i++;
} while (i <= 3) ;
} }

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 22


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Infinitive do-while Loop


In C#, if you pass true in the do-while loop, it will be infinitive do-while loop.

Syntax:
do{

//code to be executed
}while(true);

C# Infinitive do-while Loop Example

using System; Output:


public class WhileExample Infinitive do-while Loop
{ Infinitive do-while Loop
Infinitive do-while Loop
public static void Main(string[] args)
Infinitive do-while Loop
{ Infinitive do-while Loop
ctrl+c
do{
Console.WriteLine("Infinitive do-while Loop");
} while(true);
}
}

C# Arrays
Like other programming languages, array in C# is a group of similar types of elements that
have contiguous memory location. In C#, array is an object of base type System.Array. In
C#, array index starts from 0. We can store only fixed set of elements in C# array.

Advantages of C# Array

 Code Optimization (less code)


 Random Access
 Easy to traverse data
 Easy to manipulate data
 Easy to sort data etc.
Disadvantages of C# Array

 Fixed size

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 23


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Array Types
There are 3 types of arrays in C# programming:

 Single Dimensional Array


 Multidimensional Array
 Jagged Array

C# Single Dimensional Array


To create single dimensional array, you need to use square brackets [] after the type.

int[] arr = new int[5];//creating array


You cannot place square brackets after the identifier.
int arr[] = new int[5];//compile time error
Let's see a simple example of C# array, where we are going to declare, initialize and traverse
array.

using System; Output:


public class ArrayExample {
public static void Main(string[] args) { 10
0
int[] arr = new int[5];//creating array
20
arr[0] = 10;//initializing array 0
arr[2] = 20; 30
arr[4] = 30;
//traversing array
for (int i = 0; i < arr.Length; i++)
{
Console.WriteLine(arr[i]);
}
}
}

C# Array Example: Declaration and Initialization at same time


There are 3 ways to initialize array at the time of declaration.

int[] arr = new int[5]{ 10, 20, 30, 40, 50 };


We can omit the size of array.
int[] arr = new int[]{ 10, 20, 30, 40, 50 };
We can omit the new operator also.
int[] arr = { 10, 20, 30, 40, 50 };

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 24


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Multidimensional Arrays
The multidimensional array is also known as rectangular arrays in C#. It can be two
dimensional or three dimensional. The data is stored in tabular form (row * column) which is
also known as matrix.
To create multidimensional array, we need to use comma inside the square brackets. For
example:
int[,] arr=new int[3,3];//declaration of 2D array
int[,,] arr=new int[3,3,3];//declaration of 3D array

C# Multidimensional Array Example

using System; Output:


public class MultiArrayExample
{ 0 10 0
public static void Main(string[] args) 0 0 20
{ 30 0 0
int[,] arr=new int[3,3];//declaration of 2D array
arr[0,1]=10;//initialization
arr[1,2]=20;
arr[2,0]=30;
//traversal
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
Console.Write(arr[i,j]+" ");
}
Console.WriteLine();//new line at each row
}
}
}

C# Multidimensional Array Example: Declaration and initialization at same time


There are 3 ways to initialize multidimensional array in C# while declaration.
int[,] arr = new int[3,3]= { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };

We can omit the array size.


int[,] arr = new int[,]{ { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
We can omit the new operator also.
int[,] arr = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 25


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Jagged Arrays
In C#, jagged array is also known as "array of arrays" because its elements are arrays. The
element size of jagged array can be different.

Declaration of Jagged array


Let's see an example to declare jagged array that has two elements.
int[][] arr = new int[2][];

Initialization of Jagged array


Let's see an example to initialize jagged array. The size of elements can be different.

arr[0] = new int[4];


arr[1] = new int[6];

Initialization and filling elements in Jagged array


Let's see an example to initialize and fill elements in jagged array.
arr[0] = new int[4] { 11, 21, 56, 78 };
arr[1] = new int[6] { 42, 61, 37, 41, 59, 63 };

Here, size of elements in jagged array is optional. So, you can write above code as given
below:
arr[0] = new int[] { 11, 21, 56, 78 };
arr[1] = new int[] { 42, 61, 37, 41, 59, 63 };

C# Jagged Array Example

public class JaggedArrayTest { Output:


public static void Main() {
int[][] arr = new int[2][];// Declare the array 11 21 56 78
42 61 37 41 59 63
arr[0] = new int[] { 11, 21, 56, 78 };// Initialize the array
arr[1] = new int[] { 42, 61, 37, 41, 59, 63 };
// Traverse array elements
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < arr[i].Length; j++)
{
System.Console.Write(arr[i][j]+" ");
}
System.Console.WriteLine();
}
}
}

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 26


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Initialization of Jagged array upon Declaration

public class JaggedArrayTest { Output:


public static void Main() {
int[][] arr = new int[3][]{ 11 21 56 78
2 5 6 7 98 5
new int[] { 11, 21, 56, 78 },
25
new int[] { 2, 5, 6, 7, 98, 5 },
new int[] { 2, 5 }
};
// Traverse array elements
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < arr[i].Length; j++)
{
System.Console.Write(arr[i][j]+" ");
}
System.Console.WriteLine();
}
}
}

C# Strings
In C#, string is an object of System.String class that represent sequence of characters. We can
perform many operations on strings such as concatenation, comparision, getting substring,
search, trim, replacement etc.

string vs String
In C#, string is keyword which is an alias for System.String class. That is why string and
String are equivalent. We are free to use any naming convention.
string s1 = "hello";//creating string using string keyword

String s2 = "welcome";//creating string using String class

C# String Example

using System; Output:


public class StringExample {
public static void Main(string[] args) { hello
string s1 = "hello"; csharp
char[] ch = { 'c', 's', 'h', 'a', 'r', 'p' };
string s2 = new string(ch);
Console.WriteLine(s1);
Console.WriteLine(s2);
}
}
GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 27
KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# String methods

Method Name Description

Clone() It is used to return a reference to this instance of String.

It is used to compares two specified String objects. It returns an


Compare(String, String)
integer that indicates their relative position in the sort order.

It is used to compare two specified String objects by evaluating


CompareOrdinal(String,
the numeric values of the corresponding Char objects in each
String)
string..

It is used to compare this instance with a specified String object.


CompareTo(String) It indicates whether this instance precedes, follows, or appears
in the same position in the sort order as the specified string.

Concat(String, String) It is used to concatenate two specified instances of String.

It is used to return a value indicating whether a specified


Contains(String)
substring occurs within this string.

It is used to create a new instance of String with the same value


Copy(String)
as a specified String.

It is used to copy a specified number of characters from a


CopyTo(Int32, Char[],
specified position in this instance to a specified position in an
Int32, Int32)
array of Unicode characters.

It is used to check that the end of this string instance matches


EndsWith(String)
the specified string.

It is used to determine that two specified String objects have the


Equals(String, String)
same value.

It is used to replace one or more format items in a specified


Format(String, Object)
string with the string representation of a specified object.

It is used to retrieve an object that can iterate through the


GetEnumerator()
individual characters in this string.

GetHashCode() It returns the hash code for this string.

GetType() It is used to get the Type of the current instance.

GetTypeCode() It is used to return the TypeCode for class String.

It is used to report the zero-based index of the first occurrence


IndexOf(String)
of the specified string in this instance.

It is used to return a new string in which a specified string is


Insert(Int32, String)
inserted at a specified index position.

It is used to retrieve the system's reference to the specified


Intern(String)
String.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 28


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

IsInterned(String) It is used to retrieve a reference to a specified String.

It is used to indicate that this string is in Unicode normalization


IsNormalized()
form C.

It is used to indicate that the specified string is null or an Empty


IsNullOrEmpty(String)
string.

IsNullOrWhiteSpace(Strin It is used to indicate whether a specified string is null, empty, or


g) consists only of white-space characters.

It is used to concatenate all the elements of a string array, using


Join(String, String[])
the specified separator between each element.

It is used to report the zero-based index position of the last


LastIndexOf(Char)
occurrence of a specified character within String.

It is used to report the zero-based index position of the last


LastIndexOfAny(Char[]) occurrence in this instance of one or more characters specified
in a Unicode array.

It is used to return a new string whose textual value is the same


Normalize() as this string, but whose binary representation is in Unicode
normalization form C.

It is used to return a new string that right-aligns the characters


PadLeft(Int32)
in this instance by padding them with spaces on the left.

It is used to return a new string that left-aligns the characters in


PadRight(Int32)
this string by padding them with spaces on the right.

It is used to return a new string in which all the characters in the


Remove(Int32) current instance, beginning at a specified position and
continuing through the last position, have been deleted.

It is used to return a new string in which all occurrences of a


Replace(String, String) specified string in the current instance are replaced with another
specified string.

It is used to split a string into substrings that are based on the


Split(Char[])
characters in an array.

It is used to check whether the beginning of this string instance


StartsWith(String)
matches the specified string.

It is used to retrieve a substring from this instance. The


Substring(Int32) substring starts at a specified character position and continues to
the end of the string.

It is used to copy the characters in this instance to a Unicode


ToCharArray()
character array.

ToLower() It is used to convert String into lowercase.

ToLowerInvariant() It is used to return convert String into lowercase using the

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 29


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

casing rules of the invariant culture.

ToString() It is used to return instance of String.

ToUpper() It is used to convert String into uppercase.

It is used to remove all leading and trailing white-space


Trim()
characters from the current String object.

It Is used to remove all trailing occurrences of a set of


TrimEnd(Char[])
characters specified in an array from the current String object.

It is used to remove all leading occurrences of a set of


TrimStart(Char[])
characters specified in an array from the current String object.

Structure in C#
A structure is a value type, means it stores on stack. So there is no overhead to maintain the
stack and heap both. Structure does not require a separate reference variable. Its syntax is
similar to a class.

Struct is more efficient than class. All reference types are cleaned by garbage collector.
Structures cannot inherit other structures or classes. A structure in C# can contain fields.
These fields can be marked as private, public, internal. Please keep in mind that we can't
initialize a field inside a structure. However we can use parameterized constructor to initialize
the structure fields. A structure can contain constructors (Parameterized), fields, methods,
properties, indexers, operators, events, and nested types.
Structures are declared using the keyword struct.

Example
public struct Employee

{
public int EmpID;
public string Name;
public string Address;
}

Important things regarding structs

 Structs are value types.


 It does not support inheritance.
 You cannot define a default (parameterless) constructor for a struct.
 You can define parameterized constructor in struct.
 Structure can implement interface.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 30


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Example

using System; Output:


namespace ConsoleApplication1 obj1.x = 10, obj2.x = 20
{ obj1.x = 20, obj2.x = 30
struct StructValueType
{
public int x;
}
class Program
{
static void Main(string[] args)
{
StructValueType obj1;
StructValueType obj2;
obj1.x = 10;
obj2.x = 20;
Console.WriteLine("obj1.x = {0}, obj2.x = {1}", obj1.x,
obj2.x);
obj1 = obj2;
obj2.x = 30;
Console.WriteLine();
Console.WriteLine("obj1.x = {0}, obj2.x = {1}", obj1.x,
obj2.x);
Console.ReadLine();
}
}
}

In the above code the structure variables obj1 and obj2 are still separate even though we have
done obj1=obj2. Both are value types so they are not refer to each other.
If we replace the structure with class then output will be different. Because, in this case the
obj1 and obj2 will be reference type. Obj1 will be refer to obj2.
obj1.x = 10, obj2.x = 20
obj1.x = 30, obj2.x = 30
Note that in the second line both value is 30.

Properties in the structure


We can create properties in the structure. In this example we will create a structure with
members: a property, a method, and a private field.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 31


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Example

using System;
namespace ConsoleApplication1
{
struct propertyStruct
{
private int intVar ;
public int initValue
{
get
{
return intVar;
}
set
{
if (value>0)
intVar = value;
}
}
public void DisplayValue()
{
Console.WriteLine("Value is: {0}", initValue);
}
}
class Program
{
static void Main(string[] args)
{
propertyStruct obj = new propertyStruct();
obj.initValue = 25;
obj.DisplayValue();
Console.ReadLine();
}
}
}

C# Object
In C#, Object is a real world entity, for example, chair, car, pen, mobile, laptop etc.

In other words, object is an entity that has state and behavior. Here, state means data and
behavior means functionality.
Object is a runtime entity, it is created at runtime.
Object is an instance of a class. All the members of the class can be accessed through object.

Let's see an example to create object using new keyword.


Student s1 = new Student();//creating an object of Student

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 32


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

In this example, Student is the type and s1 is the reference variable that refers to the instance
of Student class. The new keyword allocates memory at runtime.

C# Class
In C#, class is a group of similar objects. It is a template from which objects are created. It
can have fields, methods, constructors etc.

Let's see an example of C# class that has two fields only.


public class Student
{
int id;//field or data member
String name;//field or data member
}

C# Object and Class Example


Let's see an example of class that has two fields: id and name. It creates instance of the class,
initializes the object and prints the object value.

using System; Output:


public class Student
{ 101
Sonoo Jaiswal
int id;//data member (also instance variable)
String name;//data member(also instance variable)
public static void Main(string[] args)
{
Student s1 = new Student();//creating an object of Student
s1.id = 101;
s1.name = "Sonoo Jaiswal";
Console.WriteLine(s1.id);
Console.WriteLine(s1.name);
}
}

C# Inheritance
In C#, inheritance is a process in which one object acquires all the properties and behaviors
of its parent object automatically. In such way, you can reuse, extend or modify the attributes
and behaviors which is defined in other class.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 33


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

In C#, the class which inherits the members of another class is called derived class and the
class whose members are inherited is called base class. The derived class is the specialized
class for the base class.

Advantage of C# Inheritance
Code reusability: Now you can reuse the members of your parent class. So, there is no need
to define the member again. So less code is required in the class.

C# Single Level Inheritance Example: Inheriting Fields


When one class inherits another class, it is known as single level inheritance. Let's see the
example of single level inheritance which inherits the fields only.

using System; Output:


public class Employee
{ Salary: 40000
public float salary = 40000; Bonus: 10000
}
public class Programmer: Employee
{
public float bonus = 10000;
}
class TestInheritance{
public static void Main(string[] args)
{
Programmer p1 = new Programmer();

Console.WriteLine("Salary: " + p1.salary);


Console.WriteLine("Bonus: " + p1.bonus);

}
}

In the above example, Employee is the base class and Programmer is the derived class.

C# Single Level Inheritance Example: Inheriting Methods


Let's see another example of inheritance in C# which inherits methods only.

using System; Output:


public class Animal
{ Eating...
Barking...
public void eat() { Console.WriteLine("Eating..."); }
}
public class Dog: Animal
{
public void bark() { Console.WriteLine("Barking..."); }

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 34


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

}
class TestInheritance2{
public static void Main(string[] args)
{
Dog d1 = new Dog();
d1.eat();
d1.bark();
}
}

C# Multi Level Inheritance Example


When one class inherits another class which is further inherited by another class, it is known
as multi level inheritance in C#. Inheritance is transitive so the last derived class acquires all
the members of all its base classes.
Let's see the example of multi level inheritance in C#.

using System; Output:


public class Animal
{ Eating...
Barking...
public void eat() { Console.WriteLine("Eating..."); }
Weeping...
}
public class Dog: Animal
{
public void bark() { Console.WriteLine("Barking..."); }
}
public class BabyDog : Dog
{
public void weep() { Console.WriteLine("Weeping..."); }
}
class TestInheritance2{
public static void Main(string[] args)
{
BabyDog d1 = new BabyDog();
d1.eat();
d1.bark();
d1.weep();
}
}

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 35


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Polymorphism
The term "Polymorphism" is the combination of "poly" + "morphs" which means many
forms. It is a greek word. In object-oriented programming, we use 3 main concepts:
inheritance, encapsulation and polymorphism.
There are two types of polymorphism in C#: compile time polymorphism and runtime
polymorphism.

 Compile time polymorphism is achieved by method overloading and operator


overloading in C#. It is also known as static binding or early binding.
 Runtime polymorphism in achieved by method overriding which is also known as
dynamic binding or late binding.
C# Runtime Polymorphism Example

using System; Output:


public class Animal{
public virtual void eat(){ eating bread...
Console.WriteLine("eating...");
}
}
public class Dog: Animal
{
public override void eat()
{
Console.WriteLine("eating bread...");
}
}
public class TestPolymorphism
{
public static void Main()
{
Animal a= new Dog();
a.eat();
}
}

C# Interface
Interface in C# is a blueprint of a class. It is like abstract class because all the methods which
are declared inside the interface are abstract methods. It cannot have method body and cannot
be instantiated.
It is used to achieve multiple inheritance which can't be achieved by class. It is used to
achieve fully abstraction because it cannot have method body.
Its implementation must be provided by class or struct. The class or struct which implements
the interface, must provide the implementation of all the methods declared inside the
interface.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 36


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# interface example
Let's see the example of interface in C# which has draw() method. Its implementation is
provided by two classes: Rectangle and Circle.

using System; Output:


public interface Drawable
{ drawing ractangle...
void draw(); drawing circle...
}
public class Rectangle : Drawable
{
public void draw()
{
Console.WriteLine("drawing rectangle...");
}
}
public class Circle : Drawable
{
public void draw()
{
Console.WriteLine("drawing circle...");
}
}
public class TestInterface
{
public static void Main()
{
Drawable d;
d = new Rectangle();
d.draw();
d = new Circle();
d.draw();
}
}

C# Delegates
In C#, delegate is a reference to the method. It works like function pointer in C and C++. But
it is objected-oriented, secured and type-safe than function pointer.
For static method, delegate encapsulates method only. But for instance method, it
encapsulates method and instance both.
The best use of delegate is to use as event.
Internally a delegate declaration defines a class which is the derived class of
System.Delegate.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 37


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

C# Delegate Example
Let's see a simple example of delegate in C# which calls add() and mul() methods.

using System; Output:


delegate int Calculator(int n);//declaring delegate
After c1
delegate,
public class DelegateExample
Number is: 120
{ After c2
static int number = 100; delegate,
public static int add(int n) Number is: 360
{
number = number + n;
return number;
}
public static int mul(int n)
{
number = number * n;
return number;
}
public static int getNumber()
{
return number;
}
public static void Main(string[] args)
{
Calculator c1 = new Calculator(add);//instantiating delegate
Calculator c2 = new Calculator(mul);
c1(20);//calling method using delegate
Console.WriteLine("After c1 delegate, Number is: " + getNumber());
c2(3);
Console.WriteLine("After c2 delegate, Number is: " + getNumber());
}
}

Events
An event is an automatic notification to users that some action has occurred. Or you can say
that events are user actions such as key press, clicks, etc. When user performs some event,
your application should respond by executing function.
Steps for working with events:
1. Create a delegate that will work as event handler.
2. Declare an event with the help of delegate.
3. Register the method with the event.
4. Perform some action for executing the event.
GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 38
KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Event handlers are represented by delegates.


The general form of an event is as follows:
event delegate-name event-name;
Example

using System;
namespace ConsoleApplication1
{
// Declare a delegate for an event.
delegate void MyEventHandler();
class SimpleEvent{
public event MyEventHandler MyEvent;
// This method will fire the event.
public void OnEvent(){
if (MyEvent != null)
MyEvent();
}
}
class Program{
static void Handler(){
Console.WriteLine("Hello My Event");
}
static void Main(string[] args)
{
SimpleEvent eventObject = new SimpleEvent();
// Add Handler() to the event list.
eventObject.MyEvent += Handler;
// Below line will fire the event.
eventObject.OnEvent();
Console.ReadLine();
}
}
}

In the above program we have craeted a delegate type for the event handler, as shown here:

delegate void MyEventHandler();


Inside the SimpleEvent class, an event called MyEvent is declared with the help of delegate:

public event MyEventHandler MyEvent;


You subscribe to an event by using this += operator. When OnEvent() method is called, then
event will be fired. Handler method will be called only if MyEvent will not be null.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 39


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Error and Exception


An exception is an error that occurs at runtime by your code. The C# language provides
structured exception handling (SEH). In C#, exceptions are represented by classes. Exception
is most base class, which can handle all types of exceptions. The .NET Framework has
several built in exception classes as example DivideByZeroException, SQLException,
IndexOutOfRangeException etc.
C# exception handling is managed by try, catch, throw, and finally blocks.
The basic structure of try, catch, and finally block is as follows:

try
{
.........
}
catch (<exceptionType> e)
{
...........
}
finally
{
..........
}

The try block


A try block contains code that requires cleanup operations or may throw an exception at
runtime. You cannot write try block only. try block must be associated with at least one catch
or finally block. try block can be nested also.

The catch Block


If exception occurs, then control directly jumps to catch block. According to the need of code
you can associate more than one catch block with try block. If the code in a try block doesn’t
throws an exception, then catch block will never execute. You must specify a catch type
catch block as example catch (Exception e) { … } or a type derived from System.Exception.
Always remember that if you are using more than one catch block associated with try block,
then catch (Exception e) { … } must be the last block within catch hierarchy. Exception class
is most base class regarding exception therefore this base class has ability to catch all type of
exception. The CLR searches from top to bottom for a matching catch type while you use try,
catch block for exception handling.

The finally Block


In the try block, exception occur or may not occur, it is guaranteed that finally block will
execute. It contains code that’s guaranteed to execute. You should write all the cleanup
operation code in finally block. Suppose that you have written code for opening database
connection in try block, then you should close the connection in try block. If you have written
the code in finally block for closing the connection, then connection must be close.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 40


KAVITHA RAJALAKSHMI D INTRODUCTION TO C#

Example

using System; Output:


namespace ConsoleApplication1 Try block started.
{ arr[0]: 0
class Program arr[1]: 1
{ arr[2]: 2
static void Main(string[ ] args) arr[3]: 3
{ arr[4]: 4
int[ ] intArr = new int[5]; ERROR : Index was outside the
try bounds of the array.
{ SOURCE :
Console.WriteLine("Try block started."); ConsoleApplication1
// Below code will generate an index out-of- Finally block.
bounds exception. After finally block.
for (int i = 0; i < 8; i++)
{
intArr[i] = i;
Console.WriteLine("arr[{0}]: {1}", i,
intArr[i]);
}
Console.WriteLine("Exception occured, this
won't be displayed");
}
catch (IndexOutOfRangeException e)
{
// Catch the exception.
Console.WriteLine("\n ERROR :"+e.Message);
Console.WriteLine("\n SOURCE :" + e.Source);
}
finally
{
Console.WriteLine("Finally block.");
}
Console.WriteLine("After finally block.");
Console.ReadLine();
}
}
}

In the given example, intArr is an int array of five elements. The for loop tries to execute
eight time and also tries to insert element in intArr from 0 to 8, which causes an
IndexOutOfRangeException to occur when an index value of 5 is tried.

GOODWILL CHRISTIAN COLLEGE FOR WOMEN Page 41

You might also like