Questions
C# questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Send an HTTP POST Request in .NET
Learn how to send HTTP POST requests in .NET, including JSON bodies, form data, headers, and best practices with HttpClient.
How to Set the Content-Type Header with HttpClient in C#
Learn how to correctly set the Content-Type header in C# HttpClient requests and avoid the Misused header name exception.
How to Sort a Dictionary by Value in C#
Learn how to sort a Dictionary by value in C# using LINQ, with examples, pitfalls, and practical patterns for real projects.
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.
How to Split a String by Newlines in .NET (C#)
Learn how to split a string by newlines in .NET using C# with Split, Environment.NewLine, and mixed line ending handling.
How to Update the GUI from Another Thread in C# WinForms
Learn the safe way to update a WinForms Label from another thread in C#, using Invoke, BeginInvoke, and thread-safe UI patterns.
How to Use GroupBy in LINQ to Group Objects and Collect Values in C#
Learn how to use LINQ GroupBy in C# to group people by PersonID and collect related values like car names into lists.
How to Use LINQ Distinct by Property in C#
Learn how to get distinct objects by one or more properties in C# using LINQ, equality comparers, GroupBy, and modern DistinctBy examples.
IQueryable vs IEnumerable in C#: Differences, Deferred Execution, and When to Use Each
Learn the difference between IQueryable and IEnumerable in C#, how deferred execution works, and when to return each in real applications.
Lesser-Known C# Features and Language Tricks for Everyday Development
Learn hidden but useful C# features like yield, var, using, nullable types, attributes, and generics with practical examples.
Multiline String Literals in C#: Verbatim and Raw String Syntax
Learn how to create multiline string literals in C# using verbatim and raw strings, with examples, comparisons, mistakes, and practice.
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.
Proper Use of yield return in C#: Deferred Execution vs ToList()
Learn when to use yield return in C#, how it differs from ToList(), and why deferred execution matters with IEnumerable and database contexts.
Select vs SelectMany in LINQ and LINQ to SQL
Learn the difference between Select and SelectMany in LINQ to SQL with clear C# examples, execution steps, mistakes, and practical use cases.
Sending Email with Gmail in .NET: SMTP Basics, Setup, and Safer Alternatives
Learn how to send email from .NET using Gmail, how SMTP works, common pitfalls, and safer approaches for real applications.
Serialize Enums as Strings in JSON with JavaScriptSerializer and .NET
Learn how enum JSON serialization works in JavaScriptSerializer, why enums become numbers, and how to output enum names as strings in .NET.
String Representation of an Enum in C#
Learn how to get string values from enums in C#, when ToString() is enough, and when to use attributes like Description or custom mapping.
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.
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.
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.