C# by Examples

Simple Code Snippets

TagsPrivacy

How to use async and await in C#

#async#fundamentals

How to check if string is null or empty

#fundamentals#strings

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

How to generate random numbers in C#

#fundamentals#random

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

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

© 2025 C# by Examples. All snippets are for educational purposes.

A project for the C# community.