0% found this document useful (0 votes)
15 views13 pages

COSC 403 Summary

.NET Framework is a software development platform by Microsoft for creating Windows applications, including both form-based and web-based applications. It consists of key components like the Common Language Runtime, Class Library, and supports multiple programming languages, with C# being a prominent one. The framework emphasizes interoperability, portability, security, and memory management, making it suitable for diverse application development.

Uploaded by

hamzahaladu002
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)
15 views13 pages

COSC 403 Summary

.NET Framework is a software development platform by Microsoft for creating Windows applications, including both form-based and web-based applications. It consists of key components like the Common Language Runtime, Class Library, and supports multiple programming languages, with C# being a prominent one. The framework emphasizes interoperability, portability, security, and memory management, making it suitable for diverse application development.

Uploaded by

hamzahaladu002
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/ 13

Chapter 1: What is .

NET Framework

The .Net framework is a software development platform developed by Microsoft. The

framework was meant to create applications, which would run on the Windows Platform. The

.Net framework can be used to create both - Form based and Web based applications. Web

services can also be developed using the .Net framework.

The architecture of the .Net framework is based on the following key components;

1. Common Language Runtime - The “Common Language Infrastructure” or CLI is a

platform on which the .Net programs are executed. The CLI has the following key

features:

 Exception Handling - Exceptions are errors which occur when the application is

executed.

 Garbage Collection - Garbage collection is the process of removing unwanted

resources when they are no longer required.

 Working with Various programming languages –As noted in an earlier section, a

developer can develop an application in a variety of .Net programming languages.


- Language - The first level is the programming language itself; the most

common ones are VB.Net and C#

- Compiler – There is a compiler which will be separate for each programming

language. So, underlying the VB.Net language, there will be a separate

VB.Net compiler. Similarly for C#, you will have another compiler.

- Common Language Interpreter – This is the final layer in .Net which would be

used to run a .net program developed in any programming language. So, the

subsequent compiler will send the program to the CLI layer to run the .Net

application.

2. Class Library - The .NET Framework includes a set of standard class libraries. A class

library is a collection of methods and functions that can be used for the core purpose.

3. Languages - The types of applications that can be built in the .Net framework are

classified broadly into the following categories.

 WinForms – This is used for developing Forms-based applications, which would

run on an end user machine. Notepad is an example of a client-based application.


 ASP.Net – This is used for developing web-based applications, which are made to

run on any browser such as Internet Explorer, Chrome or Firefox.

 ADO.Net – This technology is used to develop applications to interact with

Databases such as Oracle or Microsoft SQL Server.

The biggest advantage of the .Net framework is that it supports Windows platform. Almost

everyone works with Windows machines. The following design principles of the .Net framework

is what makes it very relevant to create .Net based applications:

1. Interoperability - The .Net framework provides a lot of backward support. Suppose if you

had an application built on an older version of the .Net framework, say 2.0. And if you

tried to run the same application on a machine which had the higher version of the .Net

framework, say 3.5. The application would still work. This is because with every release,

Microsoft ensures that older framework versions gel well with the latest version.

2. Portability- Applications built on the .Net framework can be made to work on any

Windows platform

3. Security - The .NET Framework has a good security mechanism. The inbuilt security

mechanism helps in both validation and verification of applications

4. Memory management - The Common Language runtime does all the work or memory

management. The .Net framework has all the capability to see those resources, which are

not used by a running program. It would then release those resources accordingly. This is

done via a program called the “Garbage Collector” which runs as part of the .Net

framework.

5. Simplified deployment - The .Net framework also have tools, which can be used to

package applications built on the .Net framework.


C# DATA TYPES

The C# language comes with a set of Basic data types. These data types are used to build values

which are used within an application. Let’s explore the basic data types available in C#:

1. Integer – An Integer data types is used to work with numbers. the datatype is denoted by

the Int32 keyword.

2. Double - A double data type is used to work with decimals.

3. Boolean - A boolean data type is used to work with Boolean values of true and false. In

C#, the datatype is denoted by the Boolean keyword.

4. String - A String data type is used to work with String values. In C#, the datatype is

denoted by the keyword ‘String’.

C# ENUMERATION

An enumeration is used in any programming language to define a constant set of values. For

example, the days of the week can be defined as an enumeration and used anywhere in the

program. In C#, the enumeration is defined with the help of the keyword ‘enum ‘.

C# OPERATORS AND VARIABLES

 A variable is a name given to a storage area that is used to store values of various data

types. Each variable in C# needs to have a specific type, which determines the size and

layout of the variable’s memory.

 Operators are used to perform operations on values of various data types. For example, to

perform the addition of 2 numbers, the + operator is used.


FLOW CONTROL AND CONDITIONAL STATEMENTS

1. If statement – The if statement is used to evaluate a boolean expression before executing

a set of statements. If an expression evaluates to true, then it will run one set of

statements else it will run another set of statements.


2. Switch statement – The switch statement is an enhancement to the ‘if’ statement. If you

have multiple expressions that need to be evaluated in one shot, then writing multiple ‘if’

statements become an issue.

3. While loop – The while loop is used for iterative purposes. Suppose if you want to repeat

a certain set of statements for a particular number of times, then while loop is used.

4. For loop - The ‘for’ loop is also used for iterative purposes. Suppose if you want to repeat

a certain set of statements for a particular number of times, then for loop is used.

C# ARRAYS

An array is used to store a collection or series of elements. These elements will be of the same

type. So instead of declaring a variable for each and every element, you can just declare one

variable.

CLASS AND OBJECT

Class is nothing but an encapsulation of properties and methods that are used to represent a real-

time entity.

ACCESS MODIFIERS

Access Modifiers are used to define the visibility of a class property or method. C# gives the

ability to put modifiers on class properties and methods. The class modifiers have the ability to

restrict access so that other programs cannot see the properties or methods of a class. There are

generally 3 types of access modifiers:


 Private – When this access modifier is attached to either a property or a method, it means

that those members cannot be accessed from any external program.

 Public – When this access modifier is attached to either a property or a method, it means

that those members can be accessed from any external program

 Protected - When this access modifier is attached to either a property or a method, it

means that those members can be accessed only by classes inherited from the current

class.

C# CONSTRUCTOR

A constructor is a method which has the same name as that of the class and they are used to

initialize the values of class fields when their corresponding objects are created. The following

key things need to be noted about constructor methods:

 The access modifier for the constructor needs to be made as public.

 There should be no return type for the constructor method.

C# INHERITANCE

Inheritance is a concept in which you define parent classes and child classes. The child classes

inherit methods and properties of the parent class, but at the same time, they can also modify the

behavior of the methods if required. The child class can also define methods of its own if

required.

C# POLYMORPHISM

Polymorphism is a concept wherein a method can be defined more than one time. But each time,

the function would have a different set of parameters passed on to it.


C# ABSTRACT CLASSES

An abstract class is used to define what is known as a base class. A base class is a class which

has the most basic definition of a particular requirement.

C# INTERFACE

Interfaces are used along with classes to define what is known as a contract. A contract is an

agreement on what the class will provide to an application. An interface declares the properties

and methods. It is up to the class to define exactly what the method will do.

C# COLLECTIONS

Collections are similar to Array it provides a more flexible way of working with a group of

objects. in a collection, you don’t need to define the size of the collection beforehand. You can

add elements or even remove elements from the collection at any point of time.

C# ARRAYLIST

The ArrayList collection is similar to the Arrays data type in C#. The biggest difference is the

dynamic nature of the array list collection.

 For arrays, you need to define the number of elements that the array can hold at the time

of array declaration. But in the case of the Array List collection, this does not need to be

done beforehand. Elements can actually be added or removed from the Array List

collection at any point of time.

Let’s look at the operations available for the array list collection in more detail:
1. Declaration of an Array List: An array list is created with the help of the ArrayList Data

type. The “new” keyword is used to create an object of an Arraylist. The object is then

assigned to a variable. General syntax: ArrayList a1 = new ArrayList();

2. Adding elements to an array – The add method is used to add an element to the ArrayList.

The add method can be used to add any sort of data type element to the array list. General

syntax: ArrayList.add(element);

3. Count – This method is used to get the number of items in the ArrayList collection.

General syntax: ArrayList.Count();

4. Contains - This method is used to see if an element is present in the ArrayList collection.

General syntax: ArrayList.Contains(element);

5. RemoveAt - This method is used to remove an element at a specific position in the

ArrayList collection. General syntax: ArrayList.RemoveAt(index);

C# STACK

The stack is a special case collection which represents a last in first out (LIFO) concept.

Elements are added to the stack, one on the top of each other. The process of adding an element

to the stack is called a push operation. To remove an element from a stack, you can also remove

the top most element of the stack. This operation is known as pop. Let’s look at the operations

available for the Stack collection:

1. Declaration of the stack – A stack is created with the help of the Stack Data type. The

keyword “new” is used to create an object of a Stack. The object is then assigned to the

variable. Syntax: Stack st = new Stack();

2. Adding elements to the stack – The push method is used to add an element onto the stack.

Syntax: Stack.push(element);
3. Removing elements from the stack – The pop method is used to remove an element from

the stack. The pop operation will return the topmost element of the stack. Syntax:

Stack.pop();

4. Count – This property is used to get the number of items in the Stack. Below is the

general syntax of this statement. Stack.Count();

5. Contains - This method is used to see if an element is present in the Stack. Below is the

general syntax of this statement. The statement will return true if the element exists, else

it will return the value false. Stack.Contains(element);

C# QUEUE

The Queue is a special case collection which represents a first in first out concept. Let’s look at

the operations available for the Queue collection

 Declaration of the Queue – Queue qt = new Queue();

 Adding elements to the Queue – Queue.enqueue(element);

 Removing elements from the queue – Queue.dequeuq();

 Count – Queue.Count();

 Contains - Queue.Contains(element);

C# HASHTABLE

A hash table is a special collection that is used to store key-value items. the hash table stores 2

values. So instead of storing just one value like the stack, array list and queue. Example:

 {“001”, “Dart”}

 {“002”, “Flutter”}
operations available for the Hashtable collection are:

 Declaration of the Hashtable – A Hashtable is created with the help of the Hashtable Data

type. The “new” keyword is used to create an object of a Hashtable. The object is then

assigned to the variable ht. Hashtable ht = new Hashtable();

 Adding elements to the Hashtable – Syntax: HashTable.add(“key” , “value”);

 ContainsKey - This method is used to see if a key is present in the Hashtable. Syntax:

Hashtable.Containskey(key);

 ContainsValue - This method is used to see if a Value is present in the Hashtable.

Syntax: Hashtable.ContainsValue(key);

WINDOWS FORMS APPLICATION

A Windows forms application is one that runs on the desktop computer. A Windows forms

application will normally have a collection of controls such as labels, textboxes, list boxes, etc.

FUNDAMENTALS OF DATABASE CONNECTIVITY

In working with databases, the following are the concepts which are common across all

databases.

1. Connection – To work with the data in a database, the first step is the connection. The

connection to a database consists of the below mentioned parameters.

 Database name or Data Source – The first important parameter is the database

name to which the connection needs to be established

 Credentials – The next important aspect is the username and password which

needs to be used to establish a connection to the database


 Optional parameters - For each database type, you can specify optional

parameters to provide more information on how .net should handle the connection to

the database.

2. Selecting data from the database – Once the connection has been established, the next

important aspect is to fetch the data from the database.

3. Inserting data into the database – C# can also be used to insert records into the database

4. Updating data into the database – C# can also be used to update existing records into the

database

5. Deleting data from a database – C# can also be used to delete records into the database.

Select commands to specific which rows need to be deleted can be specified in C#.

STREAMS – READING AND WRITING TO FILES

normally streams are used to read and write to files. A stream is an additional layer created

between an application and a file. The stream is used to ensure smooth read and write operations

to the file.

 Stream Reader – The stream reader is used to read data from a file using streams.

Thereafter the application reads the data from the stream.

 Stream Writer – The stream writer is used to write data to a file using streams. The data

from the application is first written into the stream. Thereafter the stream writes the data

to the file.
SERIALIZATION AND DESERIALIZATION IN C#:

 Serialization: This is the process of converting a C# object into a format that can be

easily stored or transmitted, such as a file. For instance, if you have a C# class called

Tutorial with properties like ID and TutorialName, serialization allows you to save these

properties to a file.

 Deserialization: This is the reverse process where you read the data from the file and

reconstruct the Tutorial object with the original properties.

You might also like