Introduction To Dot Net Framework

Here in this article, we will see what is dot net framework and basic concepts of the .NET framework.

 

Dot net framework

 

What is .NET framework?

Dot Net Framework:

DOT NET is a software platform. It’s a language-neutral environment for developing DOT NET applications that can easily and securely operate within it. The first version of the .Net framework was released in the year 2002. The .Net framework supports various programming languages such as Visual Basic and C#. We can create Form-based and Web-based applications using the .Net framework.

The Dot NET Framework has two main components: the Common Language Runtime (CLR) and the Dot NET Framework class library.

In this tutorial, you will learn-

 

What is CLR?

The Dot NET Framework provides a runtime environment called the Common Language Runtime (CLR).

CLR is simply an engine that takes in Intermediate Language (IL) instructions, translates them into machine instructions, and executes them.

The CLR sits at the very heart of managed code (The code which runs under the CLR is called as Managed Code). Common Language Runtime is the generalized multi-language, reflective execution engine on which code originally written in various languages runs. At a higher level,

CLR takes care of code management upon program execution and provides various services such as memory management, thread management, security management, and other system services.

In Short, We can list the Roles of CLR as follows…

Roles OF CLR in DOT NET Framework

  1. Convert Intermediate Language to Machine Level Language.
  2. Code Execution
  3. Code Management
  4. Memory Management
  5. Thread Management
  6. Exception Handling
  7. Garbage Collection
  8. Security Management.

We will see all the above topics in detail in upcoming articles.

CLR– CLR is the heart of the .Net framework and it does 4 primary important things-

1. Garbage collection

2. CAS (Code Access Security)

3. CV (Code Verification)

4. IL to Native translation.

Dot net framework: https://www.dotnetguide.com/wp-content/uploads/2020/04/CLR.png

What is .NET Framework class library?

The .NET Framework class library is a collection of reusable classes, or types, that tightly integrate with the common language runtime. The .NET Framework provides a rich set of interfaces, as well as abstract and concrete (non-abstract) classes.

You can use the concrete classes as is or, in many cases, derive your own classes from them. To use the functionality of an interface, you can either create a class that implements the interface or derive a class from one of the .NET Framework classes that implements the interface.

 

What is CTS?

Common Type System (CTS) describes how types are declared, used, and managed. CTS facilitates cross-language integration, type safety, and high-performance code execution.

When we declare an int type data type in C# and integer in VB.Net then finally after compilation they are converted to int32. In other words, now both will have a common data type that provides flexible communication between these two languages.

Dot net framework: C:\Users\Mangesh\Desktop\DOT NET GUIDE\CTS.png

The common type system supports two general categories of types: 

Value types:

A data type is a value type if it holds the data within its own memory allocation. Value types include the following:

  • All numeric data types
  • Boolean, Char, and Date
  • All structures, even if their members are reference types
  • Enumerations, since their underlying type is always SByte, Short, Integer, Long, Byte, UShort, UInteger, or ULong

Reference types:

A reference type contains a pointer to another memory location that holds the data. Reference types include the following:

  • String
  • All arrays, even if their elements are value types
  • Class types, such as Form
  • Delegates
Boxing: C:\Users\mangesh12149\Desktop\reference-type.png

Boxing and Unboxing

Boxing is the name given to the process whereby a value type is converted into a reference type. When you box a variable, you are creating a reference variable that points to a new copy on the heap. a reference variable is an object and therefore can use all the methods that every object inherits, such as, ToString(). This is what happens in the following code:

int i = 67;                              // i is a value type

object o = i;                            // i is boxed

System.Console.WriteLine(i.ToString());  // i is boxed

You will encounter unboxing when you use classes designed for use with objects: for example, using an ArrayList to store integers. When you store an integer in the ArrayList, it’s boxed. When you retrieve an integer, it must be unboxed.

System.Collections.ArrayList list = new System.Collections.ArrayList();  // list is a reference type

int n = 67;                              // n is a value type

list.Add(n);                             // n is boxed

n = (int)list[0];                        // list[0] is unboxed

The CLS is a specification that defines the rules to support language integration. This is done in such a way, that programs written in any language (.NET compliant) can interoperate with one another. This also can take full advantage of inheritance, polymorphism, exceptions, and other features.

CLS- CLS stands for Common Language Specification and is a subset of CTS. CLS is a set of rules or guidelines. The languages which follow these set of rules are said to be CLS Compliant. In simple words, CLS enables cross-language integration.

For example, one rule is that you cannot use multiple inheritance within .NET Framework. As you know C++ supports multiple inheritance but; when you will try to use that C++ code within C#, it is not possible because C# doesn’t support multiple inheritance.

One another rule is that you cannot have members with the same name with case difference only i.e. you cannot have add() and Add() methods. This easily works in C# because it is case-sensitive but when you will try to use that C# code in VB.NET, it is not possible because VB.NET is not case-sensitive.

Description: http://www.programering.com/images/remote/ZnJvbT1jbmJsb2dzJnVybD13WnVCbkwyTXpZbUpUT3hRelloTmpaNEFqTTRBRFprUlRPNUFUTmpabU5pVlRZd0lXTDNJRE56a1RNeEF6THlFek14QWpNdmtUTXlJRE16OHladnhtWXYwMmJqNXladnhtWTBsbWJqNXljbGRXWXRsMkx2b0RjMFJIYQ.jpg

 

JIT-JIT compiles the IL code to Machine code just before execution and then saves this transaction in memory.

How JIT Works?


Before MSIL(MS Intermediate Language) can be executed, it must be converted by .net Framework Just in time (JIT) compiler to native code, which is CPU specific code that runs on some computer architecture as the JIT compiler. Rather than using time and memory to convert all the MSIL in portable executable (PE) file to native code, it converts the MSIL as it is needed during execution and stored in resulting native code so it is accessible for subsequent calls.

JIT Types:

In the Microsoft .NET framework there are three types of JIT (Just-In-Time) compilers which are Explained as Under:

  • Pre-JIT Compiler (Compiles entire code into native code completely)
  • Econo JIT Compiler (Compiles code part by part freeing when required)
  • Normal JIT Compiler (Compiles only that part of code when called and places in cache

We will see these topics in detail in upcoming articles.

What is C#?

C# is Microsoft’s programming language for its new .NET development environment. Microsoft’s goal with C# is to provide a simple, modern, object-oriented .NET programming language that is Internet-centric. Although .NET code can be written in many languages, C# is the only language designed specifically for the .NET platform and for that reason may become the language of choice for this environment.

What is Asp.Net?

ASP.NET is a programming framework developed by Microsoft for building powerful Web-based applications. While not a programming language, It is the latest version of Microsoft’s ASP, a powerful, server-based technology for creating dynamic Web pages. Being a core element in the Dot NET platform, all  .NET languages utilize ASP DOT NET as their entry point for Internet development.

ASP DOT NET has built-in support for three languages: Visual Basic .NET, C#, and JScript.NET. The user can install support for other .NET-compatible languages as well. JScript.NET is Microsoft’s latest version and implementation of JavaScript. Although this version still maintains its “scripting” feel, it is fully object-oriented and compiles to MSIL.

How to Install Visual Studio?

Please check out this video to know how to install Visual Studio 2019 on Windows 10 operating system.

https://youtu.be/ZMMSRjCaTvA

Conclusion

In this article, We learned that what is dot net framework and basic concepts of the .NET framework.

The .NET Framework class library is a collection of reusable classes, that tightly integrate with the CLR. The .NET Framework provides a rich set of interfaces, as well as abstract and concrete (non-abstract) classes.

We also learned that the Dot NET Framework provides a runtime environment called the Common Language Runtime (CLR) that takes in Intermediate Language (IL) instructions, translates them into machine instructions, and executes them.

Leave a Comment

RSS
Follow by Email
YouTube
YouTube
LinkedIn
Share