COSC 403 Summary
COSC 403 Summary
NET Framework
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
The architecture of the .Net framework is based on the following key components;
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.
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
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
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
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
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
3. Boolean - A boolean data type is used to work with Boolean values of true and false. In
4. String - A String data type is used to work with String values. In C#, the datatype is
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 ‘.
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
Operators are used to perform operations on values of various data types. For example, to
a set of statements. If an expression evaluates to true, then it will run one set of
have multiple expressions that need to be evaluated in one shot, then writing multiple ‘if’
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 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
Public – When this access modifier is attached to either a property or a method, it means
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
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,
An abstract class is used to define what is known as a base class. A base class is a class which
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
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
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
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.
4. Contains - This method is used to see if an element is present in the ArrayList collection.
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
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
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
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
C# QUEUE
The Queue is a special case collection which represents a first in first out concept. Let’s look at
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
ContainsKey - This method is used to see if a key is present in the Hashtable. Syntax:
Hashtable.Containskey(key);
Syntax: Hashtable.ContainsValue(key);
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.
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
Database name or Data Source – The first important parameter is the database
Credentials – The next important aspect is the username and password which
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
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#.
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.
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