Today I was asked to explain what .NET actually is. Hopefully I won’t show too much ignorance here.
The .NET Framework refers to two things: the Common Language Runtime (CLR) and the Base Class Libraries (BCL). The CLR is a virtual runtime environment for applications which provides basic features such as code security, memory management, and exception handling. It is based on an open specification written by Microsoft called the Common Language Infrastructure (CLI). “.NET” specifically refers to Microsoft’s implementation of the CLI. In theory, anyone can implement the CLI on non-Windows environments. In reality, the only other major implementation is Xamarin’s Mono for Linux/OSX/Android. The BCL is a set of core .NET DLLs from Microsoft.
The CLR provides interoperability between all CLI compatible languages including C#, VB.NET, F#, IronRuby, IronPython, Nemerle, Boo, and many others so code written in one language can natively call code in assemblies compiled from another. The CLR is a just-in-time compiler. .NET code is actually compiled to CIL (Common Intermediate Language, formerly MSIL), a quasi-assembly language. Before each method is called for the first time, the CLR converts it to machine code compatible with the processor it is running on. It also monitors what code paths are frequently executed and optimizes them further. The CLR does runtime boundary checking so it’s guaranteed not to call memory addresses it shouldn’t. It’s not possible to have a buffer overflow in .NET.
The BCL DLLs abstract away interfacing with the Windows API and provides common data structures, file system and network access, user interface elements, LINQ, XML parsing, encryption tools, and tons of other useful features. The BCL is far larger than the standard C++ libraries.
One point of confusion may be the difference between classic Visual Basic and VB.NET. The final version of classic Visual Basic was VB6, which was introduced in 1998 and officially retired in 2008. The first version of VB.NET was introduced in 2002 and is actively developed today. While VB.NET is seen as the next evolution of VB6, it is only similar in syntax. VB.NET eliminated pointers, the variant type, Option Strict/Explicit, and ActiveX dependencies. It introduced formal object-oriented features including inheritance and function overloading. VB6 arrays were 1-indexed while VB.NET arrays are 0-indexed. Directly porting programs between the two languages is not generally feasible. A subset of VB6 lives on today as VBA, a scripting language for Windows and Office.