Introduction to .Net
Introduction to .Net
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.
Value types:
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.
•Identity: It gives a unique name to an object and enables one object to interact with
other objects.
Example:
C# has roots from the C family, and the language is close to other popular languages like C++ and
Java.
C# is used for:
• Mobile applications
• Desktop applications
• Web applications
• Web services
Syntax:
Example:
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:
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
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
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