Questions

C# questions

Choose a question page, learn the concept, then test your understanding with a quiz.

How to Sort a List<T> by an Object Property in C#

Learn how to sort a List<T> by object properties in C# using Sort, LINQ OrderBy, ThenBy, and custom comparisons.

csharpgenericslistsorting

Proper Use of IDisposable in C#: Managed vs Unmanaged Resources

Learn when to use IDisposable in C#, what Dispose should clean up, and whether clearing managed collections frees memory faster.

csharp.netgarbage-collectionidisposable

String to byte[] in C#: Why Encoding Matters in .NET

Learn why C# strings need an encoding to become byte arrays, how .NET stores strings, and how to get consistent bytes safely.

csharp.netstringcharacter-encoding

String vs string in C#: What's the Difference?

Learn the difference between String and string in C#, when they are equivalent, and which style to use in real code.

csharp.netstringtypes

Understanding Visual Studio Breakpoints and PDB Symbols in C#

Learn why Visual Studio says no symbols have been loaded, what PDB files do, and how to fix C# breakpoints that will not be hit.

csharp.netdebuggingbreakpoints

Using Directives Inside vs Outside a Namespace in C#

Learn why C# using directives can be placed inside or outside a namespace, how scope changes, and what StyleCop is enforcing.

csharp.netnamespacesstylecop

What Is a NullReferenceException in C# and How Do You Fix It?

Learn what a NullReferenceException means in C#, why it happens, and practical ways to prevent and fix null reference errors.

csharp.netvb.netnull

What the ?? Operator Means in C#

Learn what the ?? null-coalescing operator means in C#, how it works, when to use it, and how it differs from the ternary operator.

csharpnull-coalescing-operator

What the [Flags] Enum Attribute Means in C#

Learn what the [Flags] enum attribute does in C#, how bit flags work, and how to combine enum values safely with clear examples.

csharpenumsflags

When to Use struct vs class in C#: Value Types Explained

Learn when to use struct instead of class in C#, including value semantics, size guidelines, immutability, and practical examples.

csharpstruct

Why Inheriting from List<T> Is Usually a Bad Idea in C#

Learn when to inherit from List<T> in C#, why composition is usually better, and how to model custom collections safely.

csharp.netlistoop

Why Override GetHashCode When Overriding Equals in C#

Learn why GetHashCode must match Equals in C#, how hash-based collections work, and how to implement both methods correctly.

csharpoverridinghashcode

Page 2 of 2 - 32 questions