C# by Examples
Simple Code Snippets
Tags
Privacy
How to use async and await in C#
#async
#fundamentals
When to Use async/await vs Task.Run in C#
#async
#fundamentals
#performance
How to check if string is null or empty
#fundamentals
#strings
When to Use const vs readonly in C#
#fundamentals
#types
How to convert int to enum in C#
#fundamentals
#enums
#types
How to convert string to int in C#
#fundamentals
#types
How to format DateTime in C#
#fundamentals
#datetime
When to Use Dictionary vs Hashtable in C#
#collections
#fundamentals
When to Use foreach vs for Loop in C#
#fundamentals
#loops
#performance
How to generate random numbers in C#
#fundamentals
#random
When to Use HashSet vs List in C#
#collections
#fundamentals
#performance
When to Use IEnumerable vs IQueryable in C#
#linq
#collections
#fundamentals
When to Use Interface vs Abstract Class in C#
#oop
#fundamentals
#design-patterns
How to iterate over a dictionary
#collections
#loops
How to join strings in C#
#fundamentals
#strings
How to filter collections with LINQ Where
#linq
#collections
How to Check if a List is Empty
#collections
#linq
#fundamentals
When to use List vs Array in C#
#collections
#fundamentals
How to Merge Two Lists
#collections
#linq
How to use the null coalescing operator in C#
#fundamentals
#operators
How to use nullable reference types in C#
#fundamentals
#types
When to use Parse vs TryParse in C#
#fundamentals
#types
How to Read a Text File
#file-io
#fundamentals
When to Use ref vs out Parameters in C#
#fundamentals
#methods
How to remove duplicates from a list
#collections
#linq
How to sort a list in C#
#collections
#linq
How to use string interpolation in C#
#fundamentals
#strings
What is the difference between String and string in C#
#fundamentals
#types
How to use StringBuilder in C#
#fundamentals
#strings
When to Use Struct vs. Class
#fundamentals
#types
#oop
How to use switch expressions in C#
#fundamentals
#patterns
How to use try catch finally in C#
#fundamentals
#exceptions
When to Use Tuple vs ValueTuple in C#
#fundamentals
#types
When to Use var vs Explicit Types in C#
#fundamentals
#best-practices