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 >>

40 C# Interview Questions for Freshers (2026, with Answers)

C# interview questions for freshers cheat sheet: six question areas with must-know answers from real .NET 10 runs

Imagine a recruiter from a Dallas insurance company books your first .NET phone screen for Monday: 30 minutes, “mostly C# basics.” You’ve got one weekend. Most C# interview questions for freshers come from six areas: types, OOP, strings and collections, exceptions, LINQ and async basics, and modern C# features. Quick answer: learn the 40 questions … Read more >>

How to Format a Number with Commas and Decimals in C#

C# format number with commas: 9876543.219 formatted with ToString("N2") as 9,876,543.22

Need 1234567 to print as 1,234,567? To format a number with commas in C#, call number.ToString(“N0”) for whole numbers or ToString(“N2”) for two decimals, and pass an en-US culture so the separator doesn’t change from machine to machine. In this tutorial, I’ll cover each case I’ve hit in production code for C# format number with … Read more >>

How to Check If a String Contains a Character in C#

C# string contains character: the string evan@reed shown as a character grid with the @ at index 4, Contains('@') returns True

Need to know if a name, email or code has a certain letter in it? In C#, text.Contains(‘M’) answers that in one call and returns true or false. In this tutorial, I’ll walk one customer name, Jenna Morales, through each C# string contains character check worth knowing on .NET 10: Output: ‘M’ is in “Jenna … Read more >>