DotNet and CLR
At the heart of the .NET Framework is the Common Language Runtime (CLR). In addition to acting as a virtual machine, interpreting and executing IL code on the fly, the CLR performs numerous other functions, such as type safety checking, application memory isolation, memory management, garbage collection, and crosslanguage exception handling. The CLR greatly simplifies crosslanguage communication through the introduction of the Common Type System (CTS). The CTS defines all of the basic types that can be used in the .NET Framework and the operations that can be performed on those types. Applications can create more complex types, but they must be built from the types defined by the CTS.
All CTS types are classes that derive from a base class called System. Object (this is true even for “primitive” types such as integer and floating point variables). This means that any object executing inside the CLR can utilize the member functions of the System.Object class.
Consider the following straightforward C# fragment:
int a=5; int b=5; if (a==b) { System.Console.WriteLine("a is the same as b"); }
Since all types inherit from System.Object, the code could be rewritten as:
int a=5; int b=5; if (a.Equals(b)) { System.Console.WriteLine("a is the same as b"); }
COMMON LANGUAGE SPECIFICATION
A subsection of the CTS called the Common Language Specification(CLS) specifies how .NET languages share and extend one another’s libraries.
CODE ACCESS SECURITY
The CLR is also burdened with the responsibility of security. An integral part of the .NET Runtime is something called Code Access Security (CAS), which associates a certain amount of “trust” with code, depending on the code’s origins (the local file system, intranet, Internet, etc.). The CLR is responsible for making sure that the code it executes stays within its designated security boundaries. This could include such things as reading and writing files from the user’s hard drive, making registry entries, and so forth. You can modify the permissions that are granted to code from a certain location using a utility called CASPOL.EXE.
VB to .NET To mitigate the effort required to convert existing VB projects, Microsoft has provided the Microsoft.VisualBasic. Compatibility runtime DLL, which allows you to use some intrinsic elements of the Visual Basic language. However, not all intrinsic elements are supported.
Conclusion The .NET Runtime is a collection of classes that can be uniformly accessed by any language capable of producing IL code. Functionality that was traditionally provided by the language environment is now supplied by the Runtime classes. This greatly simplifies the development process, as one only has to familiarize oneself with a common framework, instead of a language-dependent API. The Runtime classes are organized using namespaces, which makes them easier to access and syntactically more concise.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|