0% found this document useful (0 votes)
2 views

Introduction to .Net

.NET Framework is a software development framework for building applications on Windows, providing tools, programming languages, and libraries. It includes key components like the Common Language Runtime (CLR), .NET Framework Class Library (FCL), and supports multiple programming languages for interoperability. C# is an object-oriented programming language within the .NET Framework, known for its ease of use and community support.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Introduction to .Net

.NET Framework is a software development framework for building applications on Windows, providing tools, programming languages, and libraries. It includes key components like the Common Language Runtime (CLR), .NET Framework Class Library (FCL), and supports multiple programming languages for interoperability. C# is an object-oriented programming language within the .NET Framework, known for its ease of use and community support.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Introduction

to .Net
- KANIKA MITTAL
.Net Framework
.NET Framework is a software development framework for
building and running applications on Windows.
.NET is a developer platform made up of tools, programming
languages, and libraries for building many different types of
applications.
Example
Imagine there is a factory. In your factory, you make different
kinds of products. But instead of making each product from
scratch every time, you have a toolbox with ready-made parts
and machines that help you build quickly.
.NET Framework is just like that toolbox for building computer
programs. It gives programmers the tools and pre-built parts to
create different types of applications, like websites, games, and
mobile apps, without starting from zero.
Architecture of .Net
The .NET Framework
consists of several key
components that work
together to make
application development
easier.
1. Common Language Runtime
(CLR)
The CLR is the core execution engine of the .NET Framework. It manages
program execution, memory allocation, and security.
Key Functions of CLR:
Memory Management – Allocates and releases memory for applications.
Garbage Collection – Automatically removes unused objects to free memory.
Exception Handling – Detects and manages runtime errors.
Security Management – Ensures secure execution of applications.
2. .NET Framework Class Library
(FCL)
• The FCL provides a large set of reusable classes and
methods for application development.
• This includes libraries for input/output operations,
networking, data access, UI controls, and more.
3. Common Type System (CTS)
CTS (Common Type System) is a key part of the .NET
Framework that ensures different programming languages can
work together smoothly.
 It defines a set of data types that all .NET languages must
follow, so they can share and use each other’s code without
compatibility issues.
CTS plays a crucial role in making .NET a language-
independent framework, allowing developers to mix and match
different .NET languages in the same project!
4. Common Language
Specification (CLS)
CLS (Common Language Specification) is a set of rules and guidelines
in the .NET Framework that all programming languages must follow to
ensure interoperability. It is a part of the Common Language Runtime
(CLR) and helps different .NET languages work together smoothly.
Since .NET supports multiple languages like C#, VB.NET, and F#, each
language has its own features. However, if one language uses features
that another language does not support, compatibility issues arise. CLS
ensures that all .NET languages can interact with each other by
defining a common set of features that every .NET language must
support.
Characteristics of .NET
Framework

Interoperability
One of the main characteristics of the .NET Framework is its language
interoperability. This means that each language can use the code written in
another language. It is a significant feature as it eliminates the language barriers
and makes the process of application development more efficient.
Base Class Library
The .NET Framework comes with a vast and robust Base Class Library (BCL) that
provides a variety of functions such as string manipulation, file handling,
database interaction, and XML document manipulation.
Characteristics of .NET
Framework

Portability
The .NET Framework is designed to run on any new version of Windows without
the need for any modifications, making it highly portable.
Language Independence
The .NET Framework supports a multitude of programming languages, including
C#, VB.NET, C++, F#, and more. This language independence gives developers
the freedom to choose the language they are most comfortable with or the one
most suitable for their specific task.
Security
The .NET Framework offers a robust and flexible security model that is designed
to prevent unauthorized access to resources and operations.
Types in .NET
The common type system defines how types are declared, used, and managed in
the common language runtime, and is also an important part of the runtime's
support for cross-language integration.

All types in .NET are either value types or reference types.

Value types:

• Value types contain the data directly.

• Value types are allocated on the stack.


Examples of Value Types:
1. Primitive Data Types (int, float, double, char, bool)
2. Structures (struct)
3. Enumerations (enum)

Reference types

Reference types store a reference to the value's memory address, and are allocated on the
heap. Reference types can be self-describing types, pointer types, or interface types. The
type of a reference type can be determined from values of self-describing types. Self-
describing types are further split into arrays and class types
Objects in .NET
An object is a fundamental data type that represents a real-world entity. It combines data
(variables) and methods (functions) that operate on the data, encapsulating behavior and
state. Objects are instances of classes, defining their structure and behavior, facilitating
the principles of object-oriented programming.

An object consists of:

•State: It is represented by attributes of an object. It also reflects the properties of an


object.

•Behavior: It is represented by the methods of an object. It also reflects the response of an


object with other objects.

•Identity: It gives a unique name to an object and enables one object to interact with
other objects.
Example:

Class CAR, Object myCar:

•Properties (Data): Brand, Color, Speed

•Actions (Behavior): Start, Accelerate, Stop


Introduction to C#
It is an object-oriented programming language created by Microsoft that runs on the .NET Framework.

C# has roots from the C family, and the language is close to other popular languages like C++ and
Java.

The first version was released in year 2002.

C# is used for:
• Mobile applications

• Desktop applications

• Web applications

• Web services

• Web sites etc.


Why Use C#?

•It is one of the most popular programming languages in the world

•It is easy to learn and simple to use

•It has huge community support

•C# is an object-oriented language which gives a clear structure to programs and


allows code to be reused, lowering development costs
•As C# is close to C, C++ and Java, it makes it easy for programmers to switch to
C# or vice versa
C# Variables
Variables are containers for storing data values.
In C#, there are different types of variables(defined with different keywords),
for example:
•int - stores integers (whole numbers), without decimals
•double - stores floating point numbers, with decimals
•char - stores single characters, such as 'a' or 'B’.
Char values are surrounded by single quotes
•string - stores text, such as "Hello World". String values are surrounded by
double quotes
•bool - stores values with two states: true or false
Declaring Variables

To create a variable, specify the type and assign it a value:

Syntax:

type variableName = value;

Example:

int num = 10;

char ch = ‘k’;
C# Constants

If you don’t someone to overwrite existing values, you can add the const keyword
in front of the variable type.

Syntax:

const int pi = 3.17;

const int num = 10;

Num = 20; //error


C# Data Types

A data type specifies the size and type of variable values.

It is important to use the correct data type for the corresponding variable; to
avoid errors, to save time and memory, but it will also make your code more
maintainable and readable.

In C#, these data types are categorized based on how they store their value in
the memory. C# includes the following categories of data types:
1.Value type
2.Reference type
Value Type Data Type Size Description

int 4 bytes Stores whole numbers from -


2,147,483,648 to 2,147,483,647

A data type is a value type if it holds long 8 bytes Stores whole numbers from -
9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
a data value within its own memory
space. It means the variables of
float 4 bytes Stores fractional numbers. Sufficient
these data types directly contain for storing 6 to 7 decimal digits

values.
double 8 bytes Stores fractional numbers. Sufficient
Examples of Value Types: for storing 15 decimal digits

1. Primitive Data Types


bool 1 byte Stores true or false values
2. Structures (struct) char 2 bytes Stores a single character/letter,
3. Enumerations (enum) surrounded by single quotes

string 2 bytes Stores a sequence of characters,


per surrounded by double quotes
characte
r
Reference Type

Unlike value types, a reference type doesn't store its value directly. Instead, it stores
the address where the value is being stored. In other words, a reference type contains
a pointer to another memory location that holds the data.

For example:
string s = "Hello World";
The followings are the reference types:
• String
• Arrays (even if their elements are value types)
• Class
• Delegate
Your best quote that reflects
your approach… “It’s one small
step for man, one giant leap for
mankind.”

- NEIL ARMSTRONG

You might also like