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# .NET

Towers of Hanoi in C#: Recursive Solution Explained

November 25, 2026July 3, 2014 by turgay

Solve the Towers of Hanoi puzzle in C# with a short recursive method, see why it needs 2^n – 1 moves, and return the moves as a sequence.

Categories C# .NET Tags C#, hanoi tower, tower of hanoi, tower of hanoi implementation 3 Comments

Sequential (Linear) Search in C#: IndexOf and a Generic Version

November 25, 2026July 3, 2014 by turgay

Find a value in an unsorted array or list in C# with IndexOf, FindIndex or your own generic linear search, and why the old sentinel trick is a bug.

Categories C# .NET, Search Algorithms Tags C#, linear search, linear search implementation, sequential search, sequential search implementation 1 Comment

Binary Search in C#: Built-in Methods and a Generic Implementation

November 25, 2026July 3, 2014 by turgay

Search a sorted array in C# with Array.BinarySearch, understand its negative return value, and write your own iterative or recursive binary search.

Categories C# .NET, Search Algorithms Tags binary search, binary search implementation, C# 1 Comment

Format a Number in Scientific Notation in C#

November 25, 2026June 27, 2014 by turgay

Format doubles and integers in scientific (exponential) notation in C# with the E format specifier or custom patterns like 0.##E+0, with culture-safe output.

Categories C# .NET, String Formatting 2 Comments

WinForms Chart Control in C#: Bar and Spline Chart Examples

November 25, 2026June 27, 2014 by turgay

Draw bar and spline charts with the WinForms Chart control in C#, how to use it on .NET 8 where it is not included, and the alternatives.

Categories C# .NET, WinForms Tags .net charting library, bar chart control, C#, c# charting library, spline chart control, windows form chart control 7 Comments
Older posts
Newer posts
← Previous Page1 … Page9 Page10 Page11 … Page17 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