December 13, 2018 10:27 by
Peter
An application is said to be multilingual if it can be deployed in many different languages. With .NET, all of the languages including Visual Basic, .NET, C#, and J# compile to a common Intermediate language (IL). This makes all languages interoperable. Microsoft has created Java bytecode, which is a low-level language with a simple syntax, which can be very quickly translated into native machine code.
CLR
.NET Framework is a multilingual application because of CLR. CLR is the key of .NET Framework. The code running under the control of the CLR is often termed as managed code.
The main task of CLR is to convert compiled code into the native code.
.NET Framework has one or more compilers; for e.g., VB .NET, C#, C++, JScript or any third party compiler such as COBOL. Anyone of these compilers will convert your source code into Microsoft Intermediate Language (MSIL). The main reason for .NET to be multilingual is that you can compile your code from IL and this compiled code will be interoperable with the code that has been compiled to IL from another language.
It simply means that you can create pages in different languages (like C#, VB .NET, J# etc.) and once all of these pages are compiled they all can be used in a single application. Let us understand this point clearly with an example.
Let us consider a situation where a customer needs an application to be ready in 20 days. For completing the application in 20 days we want 30 developers who all know the specific language but we have 15 developers who know C# and 15 developers who know VB .NET. In this situation, if we don’t use .NET then we need to hire 15 more developers of C# or VB .NET which is a difficult and costly solution. Now, if we use .NET then we can use C# and VB .NET language in the same application. This is possible because once C# code is compiled from IL it becomes interoperable with VB .NET code which is compiled from IL.
Then JIT (Just In Time) of CLR converts this MSIL code into native code using metadata which is then executed by OS.
CLR stands for common language runtime. Common language runtime provides other services like memory management, thread management, remoting, and other security such as CTS and CLS.
CLR is a layer between an operating system and .NET language, which uses CTS and CLS to create code.
CTS
CTS stands for the common type system. CTS defines rules that common language runtime follows when we are declaring, using and managing type. CTS deals with the data type. .NET supports many languages and every language has its own data type. One language cannot understand data types of another language.
For example: When we are creating an application in C#, we have int and when we are creating an application in VB .NET, we have an integer. Here CTS comes into play -- after the compilation, CTS converts int and integer into the int32 structure.
CLS
CLS stands for common language specification.
CLS is a subset of CTS and it declares all the rules and restrictions that all languages under .NET Framework must follow. The language which follows these rules is known as CLS compliant.
For example, we can use multiple inheritances in c++ but when we use the same code in C# it creates a problem because C# does not support multiple inheritances. Therefore, CLS restricts multiple inheritances for all language.
One other rule is that you cannot have a member with the same name and a different case. In C# add() and Add() are different because it is case sensitive but a problem arises when we use this code in VB .NET because it is not case-sensitive and it considers add() and Add() as the same.
HostForLIFE.eu ASP.NET Core 2.2 Hosting
European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.
December 5, 2018 10:02 by
Peter
The CLR is a runtime environment of .NET to execute applications. The major function of the CLR is converting the Managed Code to native code and executing the program. Furthermore, it acts as a layer between operating systems and apps that are written in .NET languages. The common language runtime handles execution of code as well as provides useful services for implementing the program. Aside from code execution, the CLR also provides services like memory management, security management, thread management, compilation, code verification, and other system services.
CLR is due for a makeover
The common language runtime of Microsoft is due for a makeover with Microsoft announcing plans to make it more scalable and efficient. The key to the modernization would be enhancements on the intermediate language underlying the CRL, called IL, that has not been upgraded in a decade. Microsoft wants to boost the IL as well as make the CLR a richer target for programming languages. The aim of the common language runtime is to run .NET programs in an efficient manner.
One imminent enhancement includes Span<T>, pronounced ‘span of tee’. It’s a new kind that would offer framework and language features to achieve more performing, safer, low-level code. The T in Span<T> means type parameter. It would be used by C# as well as other languages to build more efficient code, which does not require copying big amounts of data or pause for garbage collection. New CRL versions would have ‘inside knowledge’ regarding Span<T> to boost speed. It will be rolled out in the next few releases of .NET.
Serving as the counterpart of Microsoft to the JVM of the world of Java, the common language runtime provides management of code of .NET languages, which include Visual Basic, C# and F#. The source code is compiled by the language compilers to the IL code. The CLR tunes the program through the execution of the IL and translating output into a machine code while the program runs. Other services are provided by the common language runtime include automatic management of memory and type safety, saving .NET programmers from providing the services.
THE ROLE OF THE COMMON LANGUAGE RUNTIME IN THE DOT NET FRAMEWORK
- Base Class libraries
Provides class libraries support to an app when required.
- Thread support
Threads are managed under the CLR. Threading means the parallel execution of code. Basically, threads are lightweight processes that are responsible for multi-tasking in a single app.
- MSIL code to native code
The CLR is an engine that compiles the source code to an intermediate language. The intermediate language’s called the Microsoft Intermediate Language. During program execution, the MSIL’s converted to the native code of the machine code. The conversion is possible via the Just-In-Time compiler. At compilation, the end result is the PE or the Portable Executable file.
- Code Manager
The common language runtime manages code. When compiling a .NET app, one does not generate code that could actually execute on the machine. The MSIL or the Microsoft Intermediate Language or IL could actually be generated. All code of .NET is IL code. The IL code is also called the Managed Code since the CLR of.NET manages it.
- COM Marshaler
It enables communication between the app and COM objects.
- CLS or Common Language Specification
It is used to communicate objects that are written in various .NET languages. It defines the standards and rules to which languages should adhere to in order to be compatible with the other languages of .NET. This lets C# developers to inherit from classes, which are defined in VB.NET or other compatible languages of .NET.
- Debug Engine
The CLR enables performing debugging an app during runtime.
- Type Checker
It verifies the types used in the app with CLS or CTS standards that are supported by the common language runtime and provides type safety.
- CTS or the Common Type System
It specifies types of data that are created in a couple of different languages compiled into the base common data type system.
- Security Engine
This enforces security permission at code level security, machine level security and folder level security with the use of .NET framework setting and tools provided by .NET.
- Exception Manager
It handles exceptions thrown by an app while executing Try-catch block that is provided by an exception. In ‘Try’ block used where a code part expects an error. In ‘Catch’ block throws exception caught from the ‘try’ block. If there’s no catch block, it would terminate an app.
- Garbage Collector
The Garbage Collectors handles automatic memory management. Furthermore, it releases memory of unused objects in an app that provides automatic memory management.
Hire ASP.NET developers from India for maximum results and solutions. With the improvements set to boost the .NET’s CLR, applications, and solutions are more effective and streamlined.
HostForLIFE.eu ASP.NET Core 2.2.1 Hosting
European best, cheap and reliable ASP.NET hosting with instant activation. HostForLIFE.eu is #1 Recommended Windows and ASP.NET hosting in European Continent. With 99.99% Uptime Guaranteed of Relibility, Stability and Performace. HostForLIFE.eu security team is constantly monitoring the entire network for unusual behaviour. We deliver hosting solution including Shared hosting, Cloud hosting, Reseller hosting, Dedicated Servers, and IT as Service for companies of all size.