Tag Archives: C# programming

Use a symbiote to graphically select hours in C#

This example modifies the previous example Graphically select hours in C# so it uses a symbiote class. That example shows how to use a PictureBox to let the user select a range of hours. If you want to let the … Continue reading

Posted in controls, graphics, user interface | Tagged , , , , , , , , , , , , | 1 Comment

Graphically select hours in C#

The DateTimePicker control lets you select dates and date ranges, but there’s no standard control that lets you select hours. This example shows one way to do this with a PictureBox. A big part of this program is the DrawHours … Continue reading

Posted in controls, graphics, user interface | Tagged , , , , , , , , , , , | 1 Comment

Remove unnecessary using directives in C#

The top of a C# code file usually includes series of using directives to tell Visual Studio which namespaces are used by the code. When you first create a project, the code files include lots of using directives that might … Continue reading

Posted in coding, performance | Tagged , , , , , , , , , | Leave a comment

Draw the Weierstrass function in C#

The Weierstrass function was discovered by Karl Weierstrass in 1872. It’s an odd function that is continuous everywhere but differentiable nowhere. I’ll explain what that means shortly. Here’s the function: Here: The following two sections explain what it means to … Continue reading

Posted in algorithms, drawing, fractals, graphics, mathematics | Tagged , , , , , , , , , , , , , , , | Leave a comment

Determine whether a file or directory exists in C#

It’s usually more efficient to check whether a file or directory exists before you try to access it. For example, if you try to read a file that doesn’t exist, the system needs to create error handling objects and a … Continue reading

Posted in files | Tagged , , , , , , , | Leave a comment

Calculate Fibonacci numbers in several ways in C#

For some background on Fibonacci numbers and φ, see Examine the relationship between the Fibonacci sequence and phi in C#. This example shows several ways to calculate Fibonacci numbers. While this is mostly for curiosity’s sake, this example does demonstrate … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , | Leave a comment

Recursively draw equations in C#

The basic idea for recursively drawing equations is simple. Well, sort of simple. Classes represent different kinds of equations. A particular class knows how to draw its kind of equation. It uses other classes to draw its pieces. For example, … Continue reading

Posted in algorithms, drawing, fonts, graphics, recursion | Tagged , , , , , , , , , , , | 2 Comments

Efficiently see if a string is blank in C#

This example uses three strings to compare different methods for determining whether a string is blank. One of the methods, the string class’s IsNullOrWhiteSpace method, only works in .NET Framework 4.5 or later, so this example targets that version of … Continue reading

Posted in performance, strings | Tagged , , , , , , , , , , , , , , | 5 Comments

Book Errata Page: The C# Helper Top 100

This is the errata page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. If you find mistakes, please post them here in the Leave a Reply box at the bottom of the page. … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Book Discussion Page: The C# Helper Top 100

This is a discussion page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. Please post questions, thoughts, and suggestions here in the “Leave a Reply” box at the bottom of the page. I … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments