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.
Best Way to Repeat a Character in C#: Building Repeated Strings Efficiently
Learn the best way to repeat a character in C#, compare StringBuilder, string concatenation, and simpler built-in options.
C# Array Initialization Syntaxes Explained
Learn all common C# array initialization syntaxes with examples, rules, comparisons, and mistakes beginners often make.
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.
C# ref vs out: What’s the Difference and When Should You Use Each?
Learn the difference between C# ref and out parameters, when to use each, and how they affect method calls, assignment, and intent.
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.
Class Library (.NET Core) vs .NET Standard in C#: Differences, Use Cases, and When to Choose Each
Learn the difference between .NET Core and .NET Standard class libraries, why both exist, and when to use each in C# projects.
Collection Was Modified During Enumeration in C#: Why It Happens and How to Fix It
Learn why C# throws 'Collection was modified' during foreach, especially with Dictionary and multithreading, and how to fix it safely.
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.
Convert List<string> to a Delimited String in C#
Learn how to convert a List<string> to a single delimited string in C# using string.Join, with examples, pitfalls, and real-world use cases.
Convert Unix Timestamp to DateTime in C#
Learn how to convert Unix timestamps to DateTime and back in C#, including UTC handling, examples, pitfalls, and best practices.
Convert byte[] to Stream in C#: Using MemoryStream
Learn how to convert a byte array to a Stream in C# using MemoryStream, with examples, common mistakes, and practical use cases.
Converting Object to Byte Array and String in C#
Learn how to convert directory property values from object to byte[] or string in C#, and when to use Encoding.UTF8.GetString correctly.
Page 1 of 6 - 112 questions