Questions
C# questions
Choose a question page, learn the concept, then test your understanding with a quiz.
AddTransient vs AddScoped vs AddSingleton in ASP.NET Core Dependency Injection
Learn the differences between AddTransient, AddScoped, and AddSingleton in ASP.NET Core DI with examples and practical usage.
C# Type Checking Explained: typeof vs GetType() vs is
Learn when to use typeof, GetType(), and is in C#. Understand exact type checks, inheritance, and safe type testing clearly.
C# Version Numbers Explained: C# vs .NET Framework and Why “C# 3.5” Is Incorrect
Learn the correct C# version numbers, how they map to .NET releases, and why terms like C# 3.5 are inaccurate and confusing.
C# const vs static readonly: When to Use Each
Learn the difference between const and static readonly in C#, when each is appropriate, and whether properties are a better choice.
C# foreach Closure Behavior Explained: Why Loop Variables Were Reused
Learn why C# foreach loop variables once caused closure bugs, how the compiler handled scope, and what changed in newer C# versions.
Call a Generic Method with a Runtime Type in C#
Learn how to call a generic method using a Type variable in C# with reflection, MakeGenericMethod, and practical examples.
Calling Async Methods from Synchronous Code in C#
Learn how to call async methods from synchronous code in C#, when it is safe, common pitfalls, and better alternatives.
Case-Insensitive String.Contains in C#
Learn how to make string.Contains case-insensitive in C#, including StringComparison, examples, pitfalls, and real-world usage.
Combining URL Parts in C#: Uri and Safe URL Joining in .NET
Learn how to combine URL parts safely in C# using Uri instead of Path.Combine, with examples, pitfalls, and practical patterns.
Const vs Readonly in C#: What's the Difference and When to Use Each
Learn the difference between const and readonly in C#, when each is evaluated, and how to choose the right one in real code.
Convert Byte Arrays to Hex Strings in Java
Learn how to convert a byte array to a hexadecimal string and back in Java with clear examples, common mistakes, and practical use cases.
Create Excel Files in C# Without Microsoft Office Installed
Learn how to create .XLSX and .XLS files in C# without installing Microsoft Office using common libraries and practical examples.
Deep Copy and Object Cloning in C#
Learn how deep copying and object cloning work in C#, with practical examples, pitfalls, and safe ways to duplicate objects.
Does try-catch Make C# Code Faster? Understanding Benchmarking, JIT Optimization, and Microbenchmarks
Learn why try-catch can appear faster in C#, and how JIT behavior, CPU timing, and poor microbenchmarks can mislead results.
Field vs Property in C#: What’s the Difference and When to Use Each
Learn the difference between fields and properties in C#, when to use each one, and how encapsulation affects real-world class design.
Fixing "Could Not Find ... bin\roslyn\csc.exe" in ASP.NET MVC
Learn why ASP.NET MVC looks for bin\roslyn\csc.exe, what Roslyn packages do, and how to fix this missing compiler error safely.
Generate Random Alphanumeric Strings in C#
Learn how to generate random 8-character alphanumeric strings in C# with clear examples, secure options, and common mistakes to avoid.
Get a Property Value from a String Using Reflection in C#
Learn how to read a property value from a string using reflection in C#, including syntax, examples, common mistakes, and safe usage patterns.
Get the Current Index in a foreach Loop in C#
Learn how to get the current index during a foreach loop in C#, when to use for instead, and common beginner-friendly patterns.
How and When to Use async and await in C#
Learn how async and await work in C#, when code runs, what await actually pauses, and why async does not automatically create threads.
Page 1 of 4 - 62 questions