Questions
C# questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Escape Curly Braces in C# String.Format
Learn how to escape literal curly braces in C# String.Format using doubled braces, with examples, mistakes, and practical use cases.
How to Escape Curly Braces in C# and .NET Format Strings
Learn how to escape curly braces in C# and .NET format strings, when to use doubled braces, and how placeholders work in String.Format.
How to Fix 'Metadata file .dll could not be found' in C# WPF
Learn why the C# WPF error 'Metadata file .dll could not be found' happens after failed builds and how to fix project references cleanly.
How to Format Numbers with Thousand Separators in .NET Using String.Format
Learn how to add commas to large numbers in .NET with String.Format, numeric format strings, and culture-aware formatting examples.
How to Format a DateTime as ISO 8601 in C#
Learn how to convert a C# DateTime to an ISO 8601 string like yyyy-MM-ddTHH:mm:ssZ, with examples, pitfalls, and best practices.
How to Generate a Random Integer in C#
Learn how to generate random integers in C# using Random, understand ranges, avoid common mistakes, and see practical examples.
How to Get AssemblyFileVersion in C#
Learn how to read AssemblyFileVersion in C# using reflection and file version APIs, with examples, pitfalls, and practical usage.
How to Get the Application Path in a .NET Console Application
Learn how to get the application path in a .NET console app using AppContext, Assembly, and Environment APIs with clear examples.
How to Get the Current Assembly Path in C#
Learn how to get the path of the assembly containing your code in C#, including pitfalls with unit test runners and reliable alternatives.
How to Get the Integer Value from an Enum in C#
Learn how to get an int value from an enum in C#, cast enums safely, and pass enum values into methods with practical examples.
How to Give a C# Auto-Property an Initial Value
Learn how to initialize C# auto-properties, when to use constructors, and the modern property initializer syntax with clear examples.
How to Group by Multiple Columns in LINQ (C#)
Learn how to group by multiple columns in LINQ using C#. See syntax, examples, execution steps, common mistakes, and a practical mini project.
How to Iterate Over a Dictionary in C#
Learn the standard ways to iterate over a Dictionary in C#, including KeyValuePair, keys, values, and common beginner mistakes.
How to Loop Through Enum Values in C#
Learn how to iterate over all enum values in C# using Enum.GetValues, with examples, common mistakes, and practical use cases.
How to Mark a Method as Obsolete or Deprecated in C#
Learn how to deprecate methods in C# using the Obsolete attribute, with examples, warnings vs errors, and migration tips.
How to Pass a Method as a Parameter in C# Using Delegates
Learn how to pass a method as a parameter in C# using delegates, Func, and lambdas with simple examples and common mistakes.
How to Query a DataTable with LINQ in C#
Learn how to use LINQ with DataTable in C#. Understand AsEnumerable, Field<T>(), filtering rows, and common mistakes with DataTable queries.
How to Randomize a List<T> in C#
Learn how to shuffle a List<T> in C# correctly using Random and the Fisher-Yates algorithm for lottery apps and other practical cases.
How to Read app.config and web.config Settings in .NET Class Libraries
Learn how to read app.config or web.config settings in a .NET class library using ConfigurationManager and modern .NET config practices.
How to Run a .NET Application as Administrator on Windows 7
Learn how a .NET app requests administrator rights on Windows 7 using manifests, UAC, and elevation best practices.