Skip to content

Commit d876ef0

Browse files
committed
added dot net core questions
1 parent 382bf06 commit d876ef0

5 files changed

Lines changed: 824 additions & 0 deletions

File tree

CORE/CO-Question01.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# CORE - Question 01 - Please explain the differences between .Net and the .Net Framework?
2+
3+
The terms **.NET** and **.NET Framework** are closely related, but they refer to **different generations and implementations** of the .NET platform. This confusion is common—so let's break it down clearly with comparisons, history, examples, and visuals (if you’d like one later).
4+
5+
---
6+
7+
## Summary: What’s the Difference?
8+
9+
| Feature | **.NET Framework** | **.NET (Core / 5 and later)** |
10+
| --------------------- | -------------------------------------------- | ------------------------------------------------- |
11+
| **Platform** | Windows-only | Cross-platform (Windows, Linux, macOS) |
12+
| **Release Year** | 2002 | .NET Core: 2016; .NET 5+: 2020+ |
13+
| **Current Status** | Legacy (maintenance mode) | Actively developed and recommended |
14+
| **Deployment** | System-wide install (GAC) | Self-contained or framework-dependent |
15+
| **App Models** | WinForms, WPF, ASP.NET, WCF | ASP.NET Core, WinForms/WPF (Windows only), Blazor |
16+
| **Open Source?** | Partially | Fully Open Source (.NET Foundation) |
17+
| **Unified Platform?** | No – multiple versions for different targets | Yes – “One .NET” for all workloads |
18+
19+
---
20+
21+
## Historical Context
22+
23+
### .NET Framework
24+
25+
* Introduced in **2002** with .NET 1.0
26+
* Built **only for Windows**
27+
* Supports:
28+
29+
* ASP.NET (WebForms, MVC)
30+
* WinForms
31+
* WPF
32+
* WCF
33+
* WF (Workflow)
34+
* Entity Framework (classic)
35+
* Latest version: **.NET Framework 4.8.1** (still supported, but **no new features** planned)
36+
37+
### .NET (aka .NET Core / .NET 5+)
38+
39+
* Introduced as **.NET Core** in **2016**
40+
* Evolved into unified **.NET 5** in **2020**
41+
* Fully **cross-platform**
42+
* Modular, cloud-friendly, open-source
43+
* Supports:
44+
45+
* ASP.NET Core (Web APIs, Blazor, SignalR)
46+
* Console apps
47+
* WinForms/WPF (Windows only)
48+
* MAUI (cross-platform UI)
49+
* gRPC, microservices, cloud-native apps
50+
51+
---
52+
53+
## Example Scenarios
54+
55+
### Example 1: Web Application
56+
57+
* **.NET Framework**
58+
59+
```csharp
60+
public class HomeController : Controller
61+
{
62+
public ActionResult Index() => View();
63+
}
64+
```
65+
66+
* Runs only on Windows
67+
* Uses classic ASP.NET MVC/WebForms
68+
69+
* **.NET 6+**
70+
71+
```csharp
72+
var builder = WebApplication.CreateBuilder(args);
73+
var app = builder.Build();
74+
app.MapGet("/", () => "Hello from .NET!");
75+
app.Run();
76+
```
77+
78+
* Minimal API
79+
* Cross-platform
80+
* High-performance server (Kestrel)
81+
82+
---
83+
84+
## Technical Differences
85+
86+
| Category | .NET Framework | .NET (Core / 5+) |
87+
| ------------------- | --------------------------------- | -------------------------------------- |
88+
| Runtime | CLR | CoreCLR |
89+
| Packaging | GAC, system-wide install | NuGet-based, per-app |
90+
| Project files | `.csproj` (old MSBuild format) | Modern SDK-style `.csproj` |
91+
| GC & JIT | Legacy, less optimized | Tiered JIT, aggressive GC tuning |
92+
| Deployment | Requires full framework installed | Can bundle everything (self-contained) |
93+
| Mobile support | ❌ No | ✅ via MAUI/Xamarin |
94+
| WebAssembly support | ❌ No | ✅ via Blazor WASM |
95+
96+
---
97+
98+
## When to Use Each?
99+
100+
| If you’re… | Use… |
101+
| --------------------------------------------- | ---------------------------------------- |
102+
| Maintaining a large legacy Windows app | .NET Framework |
103+
| Building new apps (web, cloud, microservices) | .NET 6, 7, or 8 |
104+
| Targeting Linux/macOS or containers | .NET |
105+
| Needing highest performance and flexibility | .NET |
106+
| Using Windows Forms or WPF | .NET 6+ (Windows only) or .NET Framework |
107+
108+
---
109+
110+
## Unification: "One .NET" Vision
111+
112+
With **.NET 5 and beyond**, Microsoft merged:
113+
114+
* .NET Core
115+
* Xamarin
116+
* Mono
117+
* .NET Framework (partially)
118+
119+
…into a **single platform**: `.NET`
120+
121+
This allows you to use **one SDK, one runtime, and one set of tools** across:
122+
123+
* Cloud
124+
* Desktop
125+
* Mobile
126+
* Web
127+
* IoT
128+
* AI/ML
129+
130+
---
131+
132+
## Summary
133+
134+
* **.NET Framework** = Windows-only, legacy, full-featured, but not evolving.
135+
* **.NET (Core/5+)** = Cross-platform, modular, modern, faster, open source, and future-facing.
136+
137+
👉 If you're building a new app today, you should be using the latest **.NET (currently .NET 8)** unless you have a strong legacy dependency.
138+

CORE/CO-Question02.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# CORE - Question 02 - Please tell me what is included in .Net and the reasons why some components aren't included in .Net Core?
2+
3+
Understanding what's included in **.NET Framework** vs what's included (or excluded) in **.NET Core** (and now modern **.NET 5/6/7/8**) reveals a lot about the **goals, trade-offs, and evolution** of the platform.
4+
5+
---
6+
7+
## What’s Included in the Full .NET Framework?
8+
9+
The original **.NET Framework** (1.0–4.8) is a **monolithic**, **Windows-only** platform that includes:
10+
11+
### 🔹 1. **CLR (Common Language Runtime)**
12+
13+
* Garbage Collection
14+
* JIT compilation
15+
* Code Access Security
16+
* Exception handling
17+
* Threading and synchronization
18+
19+
### 🔹 2. **Base Class Library (BCL)**
20+
21+
* `System`, `System.Collections`, `System.IO`, `System.Text`, etc.
22+
23+
### 🔹 3. **Desktop UI Frameworks**
24+
25+
* **Windows Forms (WinForms)**
26+
* **Windows Presentation Foundation (WPF)**
27+
28+
### 🔹 4. **ASP.NET (Classic)**
29+
30+
* Web Forms
31+
* ASP.NET MVC
32+
* ASP.NET Web API
33+
34+
### 🔹 5. **Workflow & Communication**
35+
36+
* **Windows Communication Foundation (WCF)**
37+
* **Windows Workflow Foundation (WF)**
38+
39+
### 🔹 6. **Entity Framework (EF 6)**
40+
41+
* Object-Relational Mapping (ORM)
42+
43+
### 🔹 7. **Global Assembly Cache (GAC)**
44+
45+
* Shared assemblies system-wide
46+
47+
### 🔹 8. **Interop Support**
48+
49+
* COM Interop
50+
* P/Invoke
51+
52+
---
53+
54+
## Why Are Some Components **Not in .NET Core**?
55+
56+
.NET Core (and later .NET 5/6/7/8) was **rewritten from scratch** with different design goals:
57+
58+
* **Cross-platform support**
59+
* **Modularity**
60+
* **Performance and scalability**
61+
* **Cloud-readiness**
62+
* **Simplified development**
63+
64+
So Microsoft **intentionally left out or redesigned** components that didn’t align with these goals.
65+
66+
---
67+
68+
## Components Not (or Initially Not) Included in .NET Core — And Why
69+
70+
| Component / Feature | Included in .NET Core? | Reason for Exclusion or Replacement |
71+
| ---------------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------- |
72+
| **Web Forms (ASP.NET)** | ❌ No | Tightly coupled to IIS and Windows UI model |
73+
| **WCF (Windows Comm. Foundation)** | ❌ No | Complex, SOAP-heavy; replaced by gRPC, REST |
74+
| **Windows Workflow (WF)** | ❌ No | Limited usage, heavyweight, not cross-platform |
75+
| **System.Drawing (GDI+)** | Partially (platform-specific) | Windows-only dependency, replaced by `System.Drawing.Common` then moved to `SkiaSharp`, etc. |
76+
| **WinForms / WPF** | ✅ Yes (but Windows-only) | Available in .NET Core 3.0+ but limited to Windows |
77+
| **Global Assembly Cache (GAC)** | ❌ No | GAC caused versioning/deployment issues; replaced by NuGet/local deployment |
78+
| **AppDomains** | ❌ No | Complex and unsafe isolation model; replaced by `AssemblyLoadContext` |
79+
| **Code Access Security (CAS)** | ❌ No | Obsolete; never worked well cross-platform |
80+
| **Remoting** | ❌ No | Insecure, complicated, and obsolete; replaced by modern communication models |
81+
| **Full Reflection.Emit** | Partially | Reflection.Emit support is limited on non-Windows platforms |
82+
| **Enterprise Services (COM+)** | ❌ No | Very Windows-specific; rarely used outside of legacy enterprise apps |
83+
84+
---
85+
86+
## What's Included in .NET Core / .NET 5+?
87+
88+
### Always Included (Cross-platform):
89+
90+
* **CoreCLR** runtime
91+
* **Base Class Libraries (BCL)**
92+
* **ASP.NET Core**
93+
* **Entity Framework Core**
94+
* **gRPC, SignalR**
95+
* **LINQ, Span<T>, Memory<T>**
96+
* **Generic Host and Dependency Injection**
97+
* **NuGet packaging**
98+
* **System.Text.Json**
99+
* **System.IO.Pipelines**
100+
* **Self-contained deployment support**
101+
102+
### Windows-only in .NET Core:
103+
104+
* WinForms and WPF (starting in .NET Core 3.0)
105+
* COM Interop
106+
* System.DirectoryServices (partial support in .NET 7+)
107+
108+
---
109+
110+
## Example: WCF vs gRPC
111+
112+
Instead of using WCF, .NET Core pushes modern technologies:
113+
114+
### Old WCF:
115+
116+
```csharp
117+
[ServiceContract]
118+
public interface IMyService
119+
{
120+
[OperationContract]
121+
string GetData(int value);
122+
}
123+
```
124+
125+
### Modern .NET Core (gRPC or REST):
126+
127+
```csharp
128+
[ApiController]
129+
[Route("api/[controller]")]
130+
public class DataController : ControllerBase
131+
{
132+
[HttpGet("{value}")]
133+
public string Get(int value) => $"Value: {value}";
134+
}
135+
```
136+
137+
Or with gRPC:
138+
139+
```protobuf
140+
service DataService {
141+
rpc GetData (DataRequest) returns (DataReply);
142+
}
143+
```
144+
145+
---
146+
147+
## Modular Design with .NET Core
148+
149+
Instead of bundling everything, .NET Core uses **NuGet packages**:
150+
151+
```bash
152+
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
153+
dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer
154+
```
155+
156+
This modularity makes apps:
157+
158+
* Smaller
159+
* More customizable
160+
* Easier to update independently
161+
162+
---
163+
164+
## Summary
165+
166+
| .NET Framework | .NET Core / .NET 5+ |
167+
| -------------------------------- | ---------------------------------------- |
168+
| Windows-only | Cross-platform |
169+
| Monolithic (everything built-in) | Modular (install only what you need) |
170+
| GAC, Web Forms, WCF, WF | NuGet, ASP.NET Core, gRPC |
171+
| Ideal for legacy enterprise | Ideal for modern web/cloud/microservices |
172+
| Slower evolution | Fast innovation & open-source |
173+
174+

0 commit comments

Comments
 (0)