Questions

C# questions

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

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.

csharp.net.net-core.net-standard

Clean Up Excel COM Interop Objects in C#

Learn how to close Excel COM interop safely in C#, release objects in order, avoid hidden Excel.exe processes, and prevent COM reference leaks.

csharpexcelinteropcom-interop

Clone a Generic List in C#: Shallow vs Deep Copy

Learn how to clone a C# List<T>, distinguish shallow and deep copies, and safely clone the objects stored in a generic list.

csharpgenericslistclone

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.

csharpwcfconcurrencydictionary

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.

csharp.neturl

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.

csharp.netconstantsreadonly

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.

csharparrayshex

Convert Decimal to Double in C#: Explicit Numeric Conversions

Learn why C# requires an explicit decimal-to-double conversion, how to avoid integer division, and safely assign values to UI properties.

csharpfloating-pointtype-conversiondouble

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.

csharpstringlistdelimiter

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.

csharpdatetimeunixepoch

Convert a String to DateTime in C# with ParseExact

Learn to convert date strings to C# DateTime safely using DateTime.ParseExact and TryParseExact with custom format strings.

csharpstringdatetimetype-conversion

Convert a String to an Int in C# Safely

Learn how to convert TextBox text to an int in C# with int.TryParse, input validation, error handling, and safe database parameters.

csharp.netstringint

Convert an Enum to a List in C#

Learn how to enumerate every declared enum value in C# with Enum.GetValues, convert the result to a List, and handle aliases safely.

csharp.netenums

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.

csharp.netarraysstream

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.

csharpstringencodingbyte

Count Character or Substring Occurrences in a String in C#

Learn how to count characters or substrings in a string in C# using Replace, loops, and regex with examples and common mistakes.

csharpstring

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.

csharp.netexcelfile-io

Create a Comma-Separated String from IEnumerable<string> in C#

Learn the cleanest way to build comma-separated strings from IList<string> or IEnumerable<string> in C# with examples and common pitfalls.

csharpstring

Create a Folder If It Does Not Exist in C#

Learn how to check for a folder and create it if needed before saving uploaded files in C# using Directory.CreateDirectory.

csharpasp.netdirectory

DateTime vs DateTimeOffset in C#: Differences, Usage, and Best Practices

Learn the difference between DateTime and DateTimeOffset in C#, when to use each, and how to handle UTC, offsets, and time zones safely.

csharp.netdatetimetimezone

Page 2 of 9 - 162 questions