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

turgay

C# Delegates and Events Explained with a Simple Example

November 25, 2026June 14, 2014 by turgay

What delegates and events are in C#, how to declare and raise an event with EventHandler, and the traps around unsubscribing and exceptions.

Categories C# .NET Tags C#, delegate, event Leave a comment

Thread-Safe Singleton Pattern in C# Using Lazy

November 25, 2026June 14, 2014 by turgay

Implement a thread-safe, lazily created singleton in C# with Lazy, compare it with double-checked locking, and know when dependency injection is the better choice.

Categories C# .NET Tags C#, pattern, singleton pattern 1 Comment

Format a DateTime as a String in C#: Custom and Standard Formats

November 25, 2026June 13, 2014 by turgay

Format dates in C# with custom patterns like yyyy-MM-dd and standard formats like “o”, plus a specifier table and the culture traps that change output.

Categories C# .NET, String Formatting Tags datetime, datetime formatting, string formatting Leave a comment

Set GDAL_DATA and Other GDAL Paths Programmatically in C#

November 25, 2026June 13, 2014 by turgay

Point GDAL at its data and plugin folders from C# with Gdal.SetConfigOption or environment variables, and why the order of calls matters.

Categories C# .NET Tags C#, environment variable, gdal Leave a comment

Zip and Unzip Files in C# with System.IO.Compression

November 25, 2026June 13, 2014 by turgay

Create and extract zip files in C# with ZipFile and ZipArchive: zip folders or file lists, build zips in memory and extract safely.

Categories C# .NET, Files and I/O Tags C#, compression, unzip, zip Leave a comment
Older posts
Newer posts
← Previous Page1 … Page18 Page19 Page20 Page21 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