What is .NET Core?

💡 Concept Name

.NET Core

📘 Quick Intro

.NET Core is a free, open-source framework developed by Microsoft. It allows developers to build cross-platform apps for Windows, Linux, and macOS. It's known for its performance, flexibility, and support for modern web development.

🧠 Analogy / Short Story

Imagine building a car that only works on one road—frustrating, right? That's how traditional platforms worked. .NET Core is like building a car that drives on all roads—highways, city roads, or even hills—because it works across all operating systems. One framework, everywhere.

🔧 Technical Explanation

.NET Core is a lightweight, modular, and cross-platform framework used to develop cloud-ready and high-performance apps. It supports C#, F#, and VB.NET and can be used to create web apps, APIs, desktop apps, and microservices.

It uses a built-in dependency injection system and supports modern features like minimal APIs, async/await, and middleware. Unlike the legacy .NET Framework, .NET Core apps can be deployed as self-contained or framework-dependent binaries.

🎯 Purpose & Use Case

  • ✅ Build apps that run on Windows, Linux, and macOS
  • ✅ Create microservices and high-performance web APIs
  • ✅ Containerize apps using Docker
  • ✅ Integrate easily with DevOps pipelines
  • ✅ Build scalable, cloud-based enterprise apps

💻 Real Code Example

Minimal Web API in .NET Core:


// Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();

var app = builder.Build();
app.MapControllers();
app.Run();
                

Key Highlight: This uses .NET Core’s built-in DI and routing. No extra setup needed—ideal for microservices.

❓ Interview Q&A

Q1: What is .NET Core?
A: It's a modern, open-source framework for building cross-platform apps.

Q2: Difference between .NET Core and .NET Framework?
A: .NET Core is cross-platform; .NET Framework works only on Windows.

Q3: Languages supported by .NET Core?
A: C#, F#, and VB.NET.

Q4: Is .NET Core faster than .NET Framework?
A: Yes, it’s optimized for performance and scalability.

Q5: How does DI work in .NET Core?
A: Through the built-in service container using `AddSingleton`, `AddScoped`, etc.

Q6: Can I deploy .NET Core on Linux server?
A: Yes, it works perfectly on Linux environments.

Q7: What is the use of `Program.cs` in .NET Core?
A: It acts as the entry point for the app and sets up the pipeline.

Q8: How is ASP.NET Core related to .NET Core?
A: ASP.NET Core runs on .NET Core to build web apps and APIs.

Q9: How to install .NET Core CLI?
A: Download from Microsoft's official site or use package managers like `apt`, `brew`, or `choco`.

Q10: What replaced `Global.asax` in .NET Core?
A: Middleware and `Startup.cs` configuration pipeline.

📝 MCQs

Q1: Which of the following is true about .NET Core?

  • A. Only works on Windows
  • B. It is cross-platform and open-source
  • C. It is a paid Microsoft product
  • D. It replaces Java entirely

Q2: What is the default entry point of a .NET Core application?

  • A. Startup.cs
  • B. Main.cs
  • C. Program.cs
  • D. Init.cs

Q3: Which of the following CLI command creates a new .NET Core web app?

  • A. dotnet new mvc --web
  • B. dotnet create webapp
  • C. dotnet new webapp
  • D. dotnet build web

Q4: Which language is NOT officially supported by .NET Core?

  • A. C#
  • B. F#
  • C. VB.NET
  • D. Python

Q5: What is Kestrel in .NET Core?

  • A. Logging Framework
  • B. Web Server
  • C. ORM Tool
  • D. Authentication Middleware

Q6: Which of these is the correct command to restore NuGet packages in a .NET Core project?

  • A. nuget restore
  • B. dotnet restore
  • C. dotnet build --restore
  • D. restore-packages

Q7: What is the role of `Startup.cs` in a .NET Core web app?

  • A. Runs the database migration
  • B. Configures services and request pipeline
  • C. Hosts the web server
  • D. Compiles Razor views

Q8: Which method adds a service with per-request lifetime in .NET Core DI?

  • A. AddSingleton
  • B. AddScoped
  • C. AddTransient
  • D. AddPerRequest

Q9: Which command publishes a .NET Core app for production?

  • A. dotnet run --env Prod
  • B. dotnet build --prod
  • C. dotnet publish --configuration Release
  • D. dotnet deploy --release

Q10: What major version unified .NET Core and .NET Framework?

  • A. .NET Core 5
  • B. .NET 5
  • C. .NET 3.1
  • D. .NET Framework 4.8

💡 Bonus Insight

.NET Core evolved into .NET 5/6/7+ which unified the ecosystem. Now, you just use ".NET" — but the core benefits remain. It’s cross-platform, scalable, and ready for modern cloud workloads.

📄 PDF Download

Need a handy summary for your notes? Download this topic as a PDF!

💬 Feedback
🚀 Start Learning
Share:

Tags: