🧠 Top .NET & C# Interview Questions Cheat Sheet 😊 C# & OOP Key features of C#? const vs readonly vs static? Boxing vs unboxing? What is polymorphism? Interface vs abstract class? SOLID principles? What is Dependency Injection? Sealed classes? How does Garbage Collection work? 😊 .NET Core .NET Framework vs .NET Core vs .NET 5+? CLR & CTS? IIS vs Kestrel? What are NuGet packages? Middlewares in .NET Core? Role of appsettings.json? Request pipeline? Use() vs UseMiddleware() vs Run()? 😊 ASP.NET MVC / Web API What is MVC? ViewBag vs ViewData vs TempData? Action filters? Routing? Web API vs MVC? JWT authentication? What is CORS? SOAP vs REST? What is Swagger? Global exception handling? 😁 Entity Framework EF Core vs EF6? Code-first vs DB-first? Lazy vs Eager vs Explicit loading? What are migrations? Raw SQL in EF? DbContext vs DbSet? Repository pattern? Async & Multithreading Task vs Thread vs async/await? ThreadPool? lock keyword & race conditions? ConcurrentDictionary vs Dictionary? Parallel.ForEach? CancellationToken? What is a deadlock? 😇 Microservices Monolith vs Microservices? What is gRPC? Docker & deploying .NET apps? CI/CD pipeline basics? Azure Functions? OAuth2 / JWT in microservices? 😄 Design Patterns Repository & Unit of Work? Singleton vs Factory vs DI? CQRS basics? Mediator pattern? Observer pattern? ☺️ Performance & Security App performance tuning in .NET? Memory leaks & GC optimization? Caching strategies? Preventing CSRF & XSS? Encryption in C#? ☺️ Testing What is unit testing? Moq framework? TDD basics? Debugging tools in VS? Exception handling in tests? Logging in .NET Core? 😄 SQL What is ACID? Indexes & performance? Types of JOINs? Normalization vs denormalization? Preventing SQL Injection? Query optimization? SQL vs NoSQL? #DotNet #CSharp #DotNetDeveloper #ASPNetCore #BackendDevelopment #SoftwareEngineering #Programming #CodingInterview #TechInterviews #FullStackDeveloper #EntityFramework #WebAPI #Microservices #SoftwareDeveloper #TechCareer #LearnToCode #JobPreparation
.NET & C# Interview Questions Cheat Sheet
More Relevant Posts
-
🚀 Exploring the Top 10 Most Popular C#/.NET Libraries in 2025! As a .NET developer, leveraging the right libraries can boost productivity, improve code quality, and accelerate development. Here’s my list of the 10 libraries I see most commonly used in professional C#/.NET projects: 1️⃣ Newtonsoft.Json (Json.NET) – Advanced JSON serialization & deserialization. 2️⃣ Entity Framework Core – Powerful ORM for relational databases. 3️⃣ Serilog – Structured logging made easy. 4️⃣ xUnit / NUnit / MSTest – Unit testing frameworks for reliable code. 5️⃣ Dapper – High-performance micro-ORM for direct SQL queries. 6️⃣ Polly – Resilience and fault-handling library (retry, circuit breaker, fallback). 7️⃣ FluentValidation – Fluent object validation, keeping your models clean. 8️⃣ MediatR – Mediator pattern implementation for decoupling commands & queries. 9️⃣ Swashbuckle / NSwag – Automatically generate Swagger/OpenAPI documentation. 🔟 System.Text.Json – Fast native JSON handling built into .NET. 💡 Bonus mentions: Hangfire, Refit, MassTransit, RabbitMQ.Client – useful for background jobs, API clients, and messaging. Using these libraries wisely can simplify your code, increase maintainability, and save countless hours in development. Which of these do you use the most in your projects? Or do you have other favorites? Let’s discuss! 👇 #dotnet #csharp #programming #developers #softwareengineering
To view or add a comment, sign in
-
-
💡 What is LINQ? LINQ allows developers to write SQL-like queries directly in C# to fetch and manipulate data from different sources such as databases, collections, XML, and more — all in a type-safe and readable way. ⚙️ Why Use LINQ in MVC? ✔️ Simplifies data access in controllers ✔️ Reduces code complexity and improves readability ✔️ Provides compile-time checking (fewer runtime errors) ✔️ Works seamlessly with Entity Framework and DbContext 📊 How It Works in ASP.NET MVC The LINQ flow can be visualized as: ➡️ Model → DbContext → Controller (LINQ Query) → View Model: Represents the database entities (like Student, Employee, etc.) DbContext: Acts as a bridge between the model and database Controller: Uses LINQ queries to fetch and process data View: Displays the filtered and formatted data to the user 🔖 #ASPNet #MVC #CSharp #LINQ #DotNet #Programming #WebDevelopment #CodeSmart #DeveloperCommunity
To view or add a comment, sign in
-
💡 C#/.NET Tip - JSON Usage 🔥 Three Ways to Work with JSON in .NET JSON (JavaScript Object Notation) is the standard format for data exchange in modern applications. Choosing the right library can significantly impact your application's performance and maintainability. Here's a breakdown of the three main options: 🔶 Newtonsoft.Json (Json.NET) Most Popular & Feature-Rich The industry standard for years, offering extensive customization options and handling complex scenarios effortlessly. Perfect when you need advanced features like custom converters, sophisticated serialization settings, or working with complex object graphs. Excellent compatibility with legacy code makes it a safe choice for existing projects. 👍 System.Text.Json Built-in & High Performance Microsoft's modern solution, built directly into .NET with superior performance and lower memory usage. Optimized for high-throughput scenarios with excellent async support. The recommended choice for new projects where performance matters and you don't need extensive customizations. No additional package required! 🔥 NetJSON Fastest Performance The speed champion, outperforming both Newtonsoft and System.Text.Json in benchmarks. Lightweight with minimal memory allocations, making it ideal for performance-critical applications. Best suited for straightforward JSON scenarios where raw speed is the priority. Which one do you use in your projects? Share your experience in the comments! 💬 #dotnet #csharp #programming #softwaredevelopment #json #coding #webdevelopment #backend #performanceoptimization
To view or add a comment, sign in
-
-
𝗗𝗮𝗽𝗽𝗲𝗿 𝘃𝘀 𝗘𝗙 𝗖𝗼𝗿𝗲 — 𝟭𝟬 𝗔𝘅𝗲𝘀 𝗼𝗳 𝗖𝗵𝗼𝗶𝗰𝗲 Every .NET developer faces this question sooner or later, should I go with Dapper or EF Core? Both are powerful, both are proven — but they serve a little different purpose. Here is a breakdown of 10 key dimensions where they differ, from Performance and Complexity to Maintainability, Caching, and Use-case fit. 🔵 𝗗𝗮𝗽𝗽𝗲𝗿 — lightweight, raw, and lightning-fast. It is perfect for performance-critical scenarios where you want full control over SQL and minimal overhead. 🟢 𝗘𝗙 𝗖𝗼𝗿𝗲 — feature-rich ORM built for productivity. It shines when you need abstractions, relationships, LINQ queries, and long-term maintainability. What is your choice in production, Dapper, Entity Framework Core, or a 𝗵𝘆𝗯𝗿𝗶𝗱 𝗮𝗽𝗽𝗿𝗼𝗮𝗰𝗵? Let’s discuss below in comment section 👇 #dotnet #efcore #dapper #csharp #orm #dotnetdeveloper #softwarearchitecture #backenddevelopment #programming #microsoftdotnet #databasetools
To view or add a comment, sign in
-
-
Two different approaches to data access in .NET: EF Core for productivity and maintainability, Dapper for raw performance. Knowing when to use each can make a real difference in your backend architecture✅.
Software Engineer @ MoE Oman | .NET Core | ASP.NET MVC | C# | Full Stack | WPF | React | Angular | Blazor | RESTful API | Dotnet | MS SQL | Microservices | Docker | AWS | AI Enthusiast
𝗗𝗮𝗽𝗽𝗲𝗿 𝘃𝘀 𝗘𝗙 𝗖𝗼𝗿𝗲 — 𝟭𝟬 𝗔𝘅𝗲𝘀 𝗼𝗳 𝗖𝗵𝗼𝗶𝗰𝗲 Every .NET developer faces this question sooner or later, should I go with Dapper or EF Core? Both are powerful, both are proven — but they serve a little different purpose. Here is a breakdown of 10 key dimensions where they differ, from Performance and Complexity to Maintainability, Caching, and Use-case fit. 🔵 𝗗𝗮𝗽𝗽𝗲𝗿 — lightweight, raw, and lightning-fast. It is perfect for performance-critical scenarios where you want full control over SQL and minimal overhead. 🟢 𝗘𝗙 𝗖𝗼𝗿𝗲 — feature-rich ORM built for productivity. It shines when you need abstractions, relationships, LINQ queries, and long-term maintainability. What is your choice in production, Dapper, Entity Framework Core, or a 𝗵𝘆𝗯𝗿𝗶𝗱 𝗮𝗽𝗽𝗿𝗼𝗮𝗰𝗵? Let’s discuss below in comment section 👇 #dotnet #efcore #dapper #csharp #orm #dotnetdeveloper #softwarearchitecture #backenddevelopment #programming #microsoftdotnet #databasetools
To view or add a comment, sign in
-
-
🧠 Exception Handling in .NET — Small Mistakes That Break Big Systems Error handling can make or break your application’s stability — and interviewers love to test how you approach it. Here’s a quick refresher for your next interview or code review 👇 🔹 1. Catch Only What You Can Handle 👉 Avoid catch (Exception ex) everywhere. Instead, catch specific exceptions like SqlException, IOException, etc. 💡 It helps identify real root causes faster. 🔹 2. Never Swallow Exceptions ❌ Don’t do this: try { /* code */ } catch { } ✅ Always log or handle meaningfully. 🔹 3. Use finally for Cleanup ✅ Perfect for closing DB connections, streams, or files. finally { connection.Close(); } 🔹 4. Custom Exceptions Add Clarity Create meaningful exception types like InvalidUserInputException. They make debugging easier and improve code readability. 🔹 5. Global Exception Handling in ASP.NET Core 💡 Use Middleware or UseExceptionHandler() for centralized error logging. It keeps controllers clean and ensures consistent responses. ⚙️ A good developer writes code that works. A great developer writes code that fails gracefully. 💬 #dotnet #csharp #exceptionhandling #dotnetcore #backenddeveloper #cleanCode #programmingtips #softwaredevelopment #developerscommunity #interviewprep #codingbestpractices
To view or add a comment, sign in
-
🚀 Today’s Deep Dive: Servlet + JSP + JDBC I spent today diving into web-backend fundamentals, and I figured I’d share what I learned — in case it helps anyone in their journey. ✅ What I covered Servlets - What they are, why we use them (faster, multi-threaded, Java based), and how the lifecycle works (init(), service(), destroy()). JSP (Java Server Pages) - How JSP is used to create dynamic HTML, how it works under the hood (JSP → Servlet → class), and the scripting elements + implicit objects. JDBC (Java Database Connectivity) - Connecting Java to a DB: driver loading, connection creation, statements vs prepared statements, reading result sets safely. Putting it together in MVC style - Browser → Servlet → Service/DAO → DB; forward to JSP for UI. Realising how these layers work in older Java-web apps (and forming a solid base for moving into frameworks like Spring Boot). Interview & project readiness - Not just theory: I noted which questions often come up (e.g., statement vs prepared statement, servlet lifecycle) and how to set up a small project (login/signup, session management) with these technologies. 🌱 Why this matters Mastering these fundamentals gives us more than just knowledge — it builds a strong base for backend development: architecture, proper layering, secure DB access, and scalable design. By sharing this publicly, I hope someone finds it useful and maybe builds something from it too. 🙋 I’d love your input What’s the next backend topic you’d suggest I learn (or you learned recently) that made a big difference? I’m collecting ideas for my next module. #Java #ServletJSPJDBC #BackendDevelopment #WebAppArchitecture #LearningJourney #DevCommunity
To view or add a comment, sign in
-
🔥 Did you know? Dependency Injection is one of the important design patterns in .net core. In .NET Core, your classes should never create their own dependencies. Instead, the framework injects them automatically using Dependency Injection (DI). This leads to ✔ Cleaner code ✔ Better testability ✔ Loose coupling ✔ Fewer bugs Dependency Injection pattern involves 3 types of classes: Client Class: The Client class (dependent class) is a class that depends on the service class. Service Class: The Service class (dependency) is a class that provides service to the client class. Injector Class: The Injector class injects the service class object into the client class. Example: #csharp public class NotificationService { private readonly IEmailSender _email; public NotificationService(IEmailSender email) { _email = email; } } No new EmailSender() inside the class - DI handles it
To view or add a comment, sign in
-
-
🔒 Singleton Design Pattern in Java The Singleton Pattern ensures that only one object of a class is created throughout the entire application. It provides a global point of access to that single object. It’s widely used in: Logging Database connections Caches Configuration readers Thread pools 🧠 Why do we need a Singleton? Imagine a class that: Should have only one instance (like DB connection manager) Should be accessible from anywhere in the application Creating multiple objects can cause: ❌ Performance issues ❌ Inconsistency ❌ Resource conflicts Singleton avoids all these by creating only ONE shared instance. 🔍 How it works? 1️⃣ Private constructor → No one can create an object with new Singleton() 2️⃣ Static variable (instance) → Stores the single object 3️⃣ Public static method (getInstance()) → Returns the same object every time 🚀 Real-world Analogy Think of a Government: There is only one Prime Minister. Everyone accesses the PM for decisions, but you cannot create a new PM object. Singleton works exactly like that. 🔑 Key Features Only one instance Globally accessible Saves memory Controlled object creation #Java #Applets #CoreJava #JavaDeveloper #ProgrammingBasics #JSP #Servlets #WebDevelopment #FullStackDeveloper #TechLearning #LinkedInPost
To view or add a comment, sign in
-
Can you send me links for .net core and azure and angular and react