Part 1 – Understanding The .NET Platform (.NET Series)

Part 1 – Understanding The .NET Platform (.NET Series)

As a C# developer, and user of Visual Studio, it is important to have a clear understanding of the software environment in which you do your development. You should know the difference betweeen .NET Platform and .NET Framework, and .Net Core. You should also be able to define acronyms such as .NET, CLR, FCL, CTS and CLS, which are important components of the .NET Platform, and know how they connect together. As a first step, let’s clarify what the .NET Platform is.

The .NET Platform is an architecture for building software for the Windows family of operating systems, as well as numerous non-Microsoft operating systems such as iOS, macOS, macTV, macWatch, Android and Linux. This is now possible in cross-platform environments like Xamarin. A key characteristic of this architecture is that it is a “managed” environment.

Managed versus Unmanaged

In an unmanaged environment, source code is compiled into a binary executable file that can be executed by the operating system, directly. It doesn’t work that way with the managed environment of the .NET Platform, where the compilation output is not a traditional executable file but an assembly that contains intermediate language and metadata. This intermediate language is referred to as Microsoft Intermediate Language (MSIL), or simply IL.

An assembly is the fundamental unit of deployment and execution in .NET. Although it can take the form of an executable (.exe) or a dynamic link library (.dll), it is more than that, because it contains information about deployment, version control, activation scoping, and security permissions. Assemblies are loaded into memory when they are required. If they are not required, they are not loaded, which is an efficient way to manage resources in large projects. All this low-level stuff is handled by the CLR.

Understanding the .NET Platform

Common Language Runtime (CLR)

The Common Language Runtime, or CLR, is the .NET layer where assemblies are loaded and executed. The CLR execution process is complex but it starts with the Windows OS. When the Windows OS detects a .NET application, it starts the CLR and passes to it the application for execution. (If the application is not a .NET one, the Windows OS takes care of execution.) The CLR loads the assembly, finds its entry point, and begins its execution process. If the assembly references other assemblies, such as DLLs, the CLR will load those.

.NET Framework Class Library (FCL)

The .NET Framework Class Library, or FCL, is the collection of .NET APIs (Application Programming Interfaces) that can be used in a .NET application. (They are analogous to C++ header files, but they are much more than that.) The FCL includes thousands of interfaces that can be referenced into a program. Related interfaces are grouped in namespaces that have a hierarchical naming scheme. With Visual Studio’s intellisense, they can be searched and referenced more easily.

Common Language Specification (CLS)

Most of the classes, interfaces, delegates, and value types that comprise the FCL, are CLS-compliant. What this means is that they can be used by any programming language whose compiler conforms to the Common Language Specification (CLS). So the CLS provides the common set of standards to which every .NET language must adhere. As a result, a .NET application can be developed using more than one programming languages, for example, C#, Visual C++, Visual Basic, F#, and so on. Cross-language inheritance, cross-language exception handling, and cross-language debugging are also supported. As an example, you could define a basic class in C# and extend it in Visual Basic.

Common Type System (CTS)

The Common Type System, or CTS, is a specification that describes fully how the programming constructs supported by the CLR (Common Language Runtime) can interact with each other. For example, a C# int must be the same as a Visual C++ int. Their .NET type is System.Int32, which is a 32-bit integer named Int32, and is defined in the System namespace. Type interoperability is the function of the CTS.

Summary

If you develop in a .NET-aware programming language (C#, Visual C++, Visual Basic, and F#), and use Visual Studio, your understanding of the .NET Platform will have implications in the way you design your software, and write your code. The two major components of the .NET Platform are the Common Language Runtime (CLR) and the .NET Framework Class Library (FCL). The CLR takes care of low-level details that you would have to worry about in other environments, while the FCL is a rich collection of APIs (application programming interfaces) that support Universal Windows Platform programming, Windows Presentation Foundation, Windows Communication Foundation, ASP.NET, and much more. CTS and CLS ensure interoperability between that the languages that can target the .NET Platform. This enhances reusability because an existing piece of code can be consumed by code written in another programming language.

FAQs:

The .NET Platform is an architecture for developing software for the Windows family of operating systems, but also for operating systems that are non-Windows, such as Android, iOS, macOS, tvOS, watchOS, and Linux. It provides low-level services needed to interact with the operating system, application programming interfaces that can be referenced by an application, and standardization to guarantee interoperability between .NET-aware languages.

.NET is used for developing applications for the web, mobile, desktop, games, and IoT. With .NET, you can use multiple object-oriented languages to target many operating systems. The primary development environment is Visual Studio Community, with Xamarin Studio increasing in popularity.

The .NET Framework is one of the two main components of the .NET Platform. It is a huge collection of classes, interfaces, delegates, and common types that can be referenced from within an application. The other component is the Common Language Runtime (CLR).

Learning .NET involves the following steps:

  • Understanding the .NET Platform and its building blocks
  • Learning Object Oriented Programming
  • Acquiring proficiency in a .NET language, such as C#
  • Specializing in a technology like UWP, WPF, ADO.NET, ASP.NET, or Web Services
  • Learning Visual Studio.

It can be a 2-year engagement.

C# (pronounced “c sharp”) is a programming language. .NET (pronounced “dot net”) is a collection of application programming interfaces that can be referenced by C# within an application. A C# developer who wants to build an IoT application, or a VR application as an example, does not have to re-invent the wheel, but reuse the classes of the .NET framework.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Leave Comments on “Part 1 – Understanding The .NET Platform (.NET Series)”...

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.