Code reference & working examples

Useful code for the things developers actually need to do.

A growing collection of practical C#, VB.NET and SQL Server examples: loops, files, JSON, databases, application utilities and queries worth keeping around.

C#VB.NETSQL Server.NET

C#

Modern .NET examples for everyday application development, file handling, JSON and WinForms utilities.

Browse C# examples →

VB.NET

Useful VB.NET patterns for existing .NET Framework applications without pretending legacy code stopped existing.

Browse VB.NET examples →

SQL

SQL Server queries ranging from everyday joins to CTEs, window functions, deduplication and data analysis.

Browse SQL examples →

Quick Reference

C# — foreach loop
List<string> Names = new List<string> { "Jeff", "Zoey", "Emily" };

foreach (string Name in Names)
{
    Console.WriteLine(Name);
}
VB.NET — For Each loop
Dim Names As New List(Of String) From {"Jeff", "Zoey", "Emily"}

For Each Name As String In Names
    Console.WriteLine(Name)
Next
This site is intentionally example-first: find the pattern, copy it, adapt it, and get back to building the application.