What Is C#? A Beginner’s Guide to C# 14 and .NET 10

What is C#: a first C# program printing Hello, Jenna! and the .NET 10 runtime version in a VS Code style card

C# (pronounced “C sharp”) is Microsoft’s free, general-purpose programming language for building web apps, APIs, cloud services, desktop apps and Unity games. You write C#, and the .NET platform compiles and runs it on Windows, macOS and Linux. In this tutorial, I’ll explain what is C# in plain English, then have you write and run … Read more >>

Prime Number Program in C#: Check, List and Sieve Primes

Prime number program in C#: boxes 2 to 13 with the primes 2, 3, 5, 7, 11 and 13 highlighted, and the count of 25 primes from 1 to 100

Is 97 prime? A prime number program in C# answers that by trying divisors: return false below 2, return n == 2 for even numbers, then test odd divisors while i <= n / i. If none divides evenly, it’s prime. In this tutorial, I’ll grow one small PrimeTools class step by step, the way … Read more >>

How to Reverse a String in C# (7 Methods with Examples)

Reverse a string in C#: Albuquerque becomes euqreuqublA with Array.Reverse

Need to turn “Albuquerque” into “euqreuqublA”? To reverse a string in C#, copy it with ToCharArray(), flip the copy with Array.Reverse(), and wrap it in new string(…). C# strings don’t have a built-in Reverse() method, so that three-step pattern is the standard answer. In this tutorial, I’ll cover seven ways to reverse a string in … Read more >>

Leap Year Program in C#: IsLeapYear and the if/else Rule

Leap year program in C#: DateTime.IsLeapYear output showing 1900 False, 2000 True, 2024 True, 2026 False and 2028 True

February 29, 2028 is the next leap day. A leap year program in C# needs one call, DateTime.IsLeapYear(year), or one expression: (year % 4 == 0 && year % 100 != 0) || year % 400 == 0. In this tutorial, I’ll show the built-in method, the manual leap year program in C# with if/else, … Read more >>

Folder Browser Dialog in C#: Pick, Show in a TextBox, Multi-Select

Folder browser dialog in C#: FolderBrowserDialog properties SelectedPath, InitialDirectory, Multiselect and SelectedPaths

Nobody enjoys typing a long folder path. In a C# Windows Forms app, the folder browser dialog fixes that: create a FolderBrowserDialog, call ShowDialog(), and read SelectedPath when it returns DialogResult.OK. In this tutorial, I’ll put together a Report Exporter for a small Seattle accounting firm and use the folder browser dialog in C# three … Read more >>