Skip to content

C# Examples

  • Home
  • About C#
    • C# Interview Questions and Answers for .NET Developers
    • Learn C#: A Practical Path Through the Examples
  • All Posts
  • Bootstrap 5 Examples
  • Contact

C#

Compare Dates in C#: Operators, Compare and Date-Only Checks

November 25, 2026July 14, 2014 by turgay

Compare two dates in C# with operators or DateTime.Compare, ignore the time of day, measure the difference, and avoid the time zone trap.

Categories C# .NET Tags C#, compare dates Leave a comment

Create an MD5 Hash from a String in C#

November 25, 2026July 13, 2014 by turgay

Compute an MD5 hash of a string or file in C# with MD5.HashData and Convert.ToHexString, and learn when MD5 is the wrong choice.

Categories C# .NET Tags C#, c# get md5, create md5 hash, md5 hash algorithm, md5 string, md5 vs sha 2 Comments

Empty the Recycle Bin in C# with SHEmptyRecycleBin

November 25, 2026July 12, 2014 by turgay

Empty the Windows Recycle Bin from C# with the SHEmptyRecycleBin API, with or without the confirmation dialog, for all drives or a single one.

Categories C# .NET Tags C#, empty recycle bin Leave a comment

Open and Close the CD/DVD Drive Tray in C#

November 25, 2026July 12, 2014 by turgay

Eject and close the CD or DVD drive tray from C# with the mciSendString Windows API, including how to target a specific drive letter.

Categories C# .NET Tags C#, close cd drive tray, Open And Close CD Drive Tray, open cd drive tray Leave a comment

Let the User Pick a Font with FontDialog in C#

November 25, 2026July 12, 2014 by turgay

Show the WinForms FontDialog, preselect the current font, add color and a live Apply preview, and handle Cancel correctly.

Categories C# .NET, WinForms Tags C#, font dialog, FontDialog, select a font Leave a comment
Older posts
Newer posts
← Previous Page1 … Page4 Page5 Page6 … Page16 Next →

Categories

Recent Posts

  • Select XML Nodes by Name or Attribute Value in C#
  • Binary Search Tree in C#: Add, Find, Remove and Traversals
  • Select, Insert, Update and Delete Data in an Access File with C#
  • C# Collections: Which One to Use and When
  • C# ArrayList vs Generic List: Examples and When to Use Each
  • About
  • Privacy Policy
  • Contact
© 2026 C# Examples