Introduction to Operating Systems - IT1808
Handout 1
.NET Framework
C# Introduction
• C# is an object-oriented programming language that supports data
encapsulation, inheritance, polymorphism, and method overriding.
• Developed by Microsoft in the late 1990s, headed by Anders Hejlsberg.
• Used to build applications for web, windows, mobile, and cloud-based
platforms.
Features of C#
• Allows the development of console applications and web applications.
• Supports garbage collection and automatic memory management.
• Has native support for Component Object Model (COM) and Windows-based
applications.
• Primitive data types are automatically initialized (zero for value types, null for
reference types).
• Produces portable code.
• Executes in a secure, controlled runtime environment.
• Supports generics, partial types, and anonymous methods.
• Includes language-integrated query (LINQ) and lambda expressions.
.NET Framework Structure
• The .NET framework is a collection of tools, technologies, and languages used to
build and deploy applications.
Components of .NET Framework
1. Operating System
a. Manages system resources and tasks.
b. The .NET framework runs on Microsoft Operating Systems (OS), with
alternatives for other OS.
2. Common Language Runtime (CLR)
a. Manages execution of .NET code.
b. Supports debugging and exception handling.
c. Converts source code into Microsoft Intermediate Language (MSIL).
d. Uses Just-In-Time (JIT) compiler to convert MSIL into native code.
3. .NET Base Class Library
a. Contains classes and interfaces for building applications.
b. Includes namespaces like [Link], Windows Forms, [Link], and XML.
4. [Link]
a. Provides access to relational databases and data sources (e.g., SQL
Server and XML).
5. [Link]
a. Unified Web development model for enterprise-class web applications.
b. [Link] Web Forms allows drag-and-drop, event-driven development.
c. [Link] Web Services Extend the web infrastructure
d. Windows Forms contain graphical representation
6. Common Language Specification (CLS)
a. Set of basic language features that ensures operability between .NET
b. A subset of Common Type System (CTS), which defines how types are
declared, used, and managed.
7. Supported Programming Languages
a. VB, C++, C#, Jscript, and J#.
Features of .NET Framework
• Interoperability – large library and supports several programming languages. Allow
developer to write code in diff. Languages.
• Language Independence – Code compiled into Common Language
Infrastructure (CLI) enabling the exchange of data types between programs
developed in different languages.
• AJAX – Enables highly responsive web applications with minimal efforts
• Security – Uses assembly for code sharing which allows only authorized categories
of users.
• Includes Common Language Runtime, dynamic Web development, Base Class
Library, [Link], and Web Services.
Assembly Use
• An assembly is a collection of types and resources forming a logical unit of
functionality.
• Assemblies are the building blocks of the .NET framework applications, executed by
the CLR.
Types of Assemblies
1. EXE (Executable)
2. DLL (Dynamic-Link Library) – Contains functions and data for other modules.
Assembly Components
• Metadata – Description of methods, types, and resources.
• Manifest – Stores identification info, public types, and dependencies.
• [Link] - This concept of versioning enables the developers to
install new versions of the components that are not backward compatible.
• Each assembly has a 128-bit version number that is presented as a set of four (4)
decimal pieces.
Types of Assembly Deployment
1. Private Assembly – Used by one application, stored in its directory.
2. Shared Assembly – Used by multiple applications, registered in Global Assembly
Cache (GAC).
Differences between Private and Shared Assemblies:
Program Structure of C#
A C# program consists of:
• Namespace declaration
• Class
• Class methods
• Class attributes
• Main method
• Statements and expressions
• Comments
Introduction to Operating Systems - IT1808
Handout 2
Data Types
Identifiers and Keywords
• An identifier is a name of a program component used to uniquely identify
namespaces, classes, methods, variables, and constants.
• Identifiers are user-defined words.
Identifiers in this code: ConsoleApp, ComputeRectangleArea, length, width, area,
WriteLine, ReadKey.
Rules for Naming an Identifier in C#
• Must start with a letter English alphabet or an underscore (_).
• Can only contain letters, digits, and underscores (No white spaces).
• Case sensitive (Area, area, and AREA are different).
• Cannot be a reserved keyword.
• Classes and methods must begin with a capital letter.
Keywords
• Reserved words with a special predefined meaning in C#.
• Cannot be used as identifiers.
Variables
• A variable is an identifier and memory location that stores a specific value.
• Value can change during program execution.
Constants
• A constant is an identifier whose value cannot be changed.
• Must be initialized at declaration.
• Constants in C# are defined using the const keyword.
Data Types
• Specifies a set of values and operations associated with variables or constants.
• Two Types of Primitive Data Types:
o Value Types – Store value directly in memory.
o Reference Types – Store address of the value (not the actual value).
Value Types
• holds data in their own memory allocation.
• Stored directly within the variable.
Available Value Types in C#
Data Default
Description Range of Values Example
Type Value
8-bit signed sbyte size =
sbyte -128 to 127 0
integer 100;
16-bit signed short score =
short -32,768 to 32,767 0
integer 1400;
32-bit signed -2,147,483,648 to int num =
int 0
integer 2,147,483,647 12400;
64-bit signed long length =
long -2^63 to 2^63-1 0L
integer 124000L;
Logical Boolean bool isCorrect
bool true or false false
type = true;
char
Unicode 16-bit
char '\u0000' to '\uffff' '\0' firstLetter =
character
'C';
Reference Types
• Store addresses instead of actual values.
• The reference type contains the memory location of where the values are stored.
Type Conversion
• Converting a value from one data type to another.
• Two Types:
o Implicit Conversion
o Explicit Conversion
Implicit Conversion
• Lower precision → Higher precision (Automatic).
Explicit Conversion
• Higher precision → Lower precision (Must be manually cast).
Here are detailed notes based on "Introduction to Operating Systems - IT1808 Handout
3", preserving the exact wording of every term and bold text.
Introduction to Operating Systems - IT1808
Handout 3
Operators and Expressions
Operators
Operators are symbols that represent a specific mathematical or logical processing in
programming.
Operators specify which operations to perform on operands.
Types of Operators in C#:
• Arithmetic Operators
• Logical Operators
• Relational Operators
• Assignment Operators
Arithmetic Operators
Used for mathematical operations on numerical values.
Arithmetic Operators Table
Exampl Return
Opertor Description
e Value
+ Adds two operands a + b 16
Subtracts the second operand from the
- a - b 6
first operand
* Multiplies both operands a * b 55
Divides the first operand by the second
/ a / b 2
operand
% Returns the remainder after division a % b 1
Relational Operators
Used to detremine the realationship between opernds of numerical values and
generating decision , returning a Boolean (true or false).
Relational Operators Table
Operator Description Example Return Value
> First operand is greater than second a > b true
< First operand is less than second a < b false
First operand is greater than or equal to
>= a >= b true
second
<= First operand is less than or equal to second a <= b false
== Checks if both operands are equal a == b false
!= Checks if operands are not equal a != b true
Logical Operators
Used to assign a value or the result of an expression to a variable.
Logical Operators Table
Assignment Operators
Used to assign a value or an expression’s result to a variable.
Assignment Operators Table
Operator Description Example Value
= Assigns value to variable b = a 2
Adds left operand to the right operand and
+= b += a 7
assigns the result
Subtracts right operand from left operand and
-= b -= a 3
assigns result
*= Multiplies both operands and assigns result b *= a 10
Divides left operand by right operand and assigns
/= b /= a 2
result
%= Assigns remainder after division b %= a 1
++ Increments operand by 1 b++ 6
-- Decrements operand by 1 b-- 4
Expressions
An expression in C# is a combination of operands (variables) and operators that
evaluates to a single value.
Operator Precedence and Associativity
Defines rules for evaluating operators in expressions.
• Higher precedence operators execute first.
• Operators of the same precedence execute left to right.
• Assignment operators (=, +=, -=, *=, /=, %=) execute right to left.
Operator Precedence Table
• Multiplication (*) executes first → 3 * 4 = 12.
• Addition (+) executes next → 2 + 12 = 14.
The Math Class
The [Link] class includes several methods that perform variety of calculation.
Math Class Methods Table
Method Description
Pow() Raises a number to the given power.
Exp() Raises the constant e to the given power.
Log() Returns the natural log and log base 10.
Sqrt() Returns the square root of a number.
Sign() Returns the sign (-1, 0, 1) of a number.
Abs() Returns the absolute value of a number.
Ceiling(
Rounds up to the nearest integer.
)
Floor() Rounds down to the nearest integer.
Round() Rounds to the nearest integer.
Truncate
Removes the fractional part of a number.
()
Sin() Returns the sine of an angle.
Cos() Returns the cosine of an angle.
Tan() Returns the tangent of an angle.
• Math class methods are static method, so they do not require object
instantiation.