Session 2: In-Depth Explanation
Lecture Topics:
- .NET Framework, .NET Core, Mono, Xamarin differences
- Versions of the Framework
- Managed and Unmanaged Code
- Introduction to Visual Studio
- Using ILDASM
No Lab
Lecture: Detailed Explanation
1. .NET Framework, .NET Core, Mono, Xamarin Differences
The .NET ecosystem has evolved over time, with different implementations serving specific purposes. .NET 6, the focus of this course, is a unified platform, but understanding its predecessors and related technologies is crucial.
-
.NET Framework:
- Definition: A Windows-only development platform introduced in 2002, designed for desktop, web, and server applications.
- Key Features:
- Runs on Windows only.
- Includes Windows Forms, WPF (Windows Presentation Foundation), and ASP.NET for web development.
- Uses the full CLR (Common Language Runtime) with features like AppDomains and Code Access Security (CAS).
- Large Base Class Library (BCL) with Windows-specific APIs.
- Limitations:
- Not cross-platform.
- Slower release cycle compared to modern .NET.
- Legacy technology, with support ending for older versions (e.g., .NET Framework 4.8 is the last major release).
- Example Use Case: Enterprise Windows applications using Windows Forms or ASP.NET Web Forms.
-
.NET Core:
- Definition: An open-source, cross-platform subset of .NET Framework, introduced in 2016, designed for modern, high-performance applications.
- Key Features:
- Runs on Windows, macOS, and Linux.
- Optimized for cloud, web (ASP.NET Core), and microservices.
- Modular design with NuGet packages for minimal dependencies.
- Improved performance over .NET Framework (e.g., faster JIT compilation).
- Evolution: .NET Core evolved into .NET 5 and .NET 6, unifying the ecosystem.
- Example Use Case: Cross-platform web APIs using ASP.NET Core.
-
Mono:
- Definition: An open-source implementation of .NET, initiated in 2001, focused on cross-platform compatibility, especially for Linux and mobile.
- Key Features:
- Implements a subset of .NET Framework APIs.
- Used in Xamarin for mobile app development.
- Supports platforms like Linux, Android, and iOS.
- Limitations:
- Incomplete BCL compared to .NET Framework.
- Performance not as optimized as .NET Core.
- Current Role: Integrated into .NET 6 for mobile scenarios (via Xamarin/Mono).
- Example Use Case: Xamarin apps running on Android/iOS before .NET 6 unification.
-
Xamarin:
- Definition: A framework for building cross-platform mobile apps using C#, built on Mono.
- Key Features:
- Allows native iOS, Android, and Windows apps with shared C# code.
- Integrates with platform-specific APIs (e.g., UIKit for iOS, Android SDK).
- Part of .NET 6 as .NET MAUI (Multiplatform App UI), the successor to Xamarin.
- Example Use Case: Mobile apps with native UI, like a cross-platform banking app.
-
.NET 6 Unification:
-
.NET 6 combines .NET Core, Mono, and Xamarin into a single platform.
-
Supports desktop (WinForms, WPF, MAUI), web (ASP.NET Core), mobile (MAUI), and cloud.
-
Example:
// Cross-platform console app in .NET 6
Console.WriteLine($"Running on {System.Runtime.InteropServices.RuntimeInformation.OSDescription}");
-
Why This Matters:
- Understanding these differences clarifies the evolution to .NET 6 and its cross-platform capabilities, essential for modern development.
2. Versions of the Framework