Tag Archives: Windows Forms programming

Perform set operations on enumerable lists in C#

To demonstrate set operations, this example creates two lists of Person objects. The Person class implements IEquatable. The code then uses the following code to display the lists and their intersection, union, difference, and exclusive or (xor). // Display the … Continue reading

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

Draw a Sierpinski pentagon in C#

In a Sierpinski pentagon, larger pentagons are recursively divided into five smaller pentagons with a sixth uncolored pentagon in the center. The following picture shows the first four levels of the resulting fractal. For this example, I decided to think … Continue reading

Posted in drawing, fractals, graphics, recursion | Tagged , , , , , , , , , , | Leave a comment

The most popular posts at C# Helper over the last 12 months

Just for fun, here’s a list of the C# Helper web site’s most popular posts over the last 12 months. This isn’t “fair” to the most recent posts because they haven’t been posted for as long. I still think it’s … Continue reading

Posted in books, miscellany | Tagged , , , , , , , , | Leave a comment

Determine whether two lists contain the same sequences of objects in different orders in C#

The SequenceEqual method determines whether two IEnumerable sequences contain the same objects in the same order. There is a simple way to determine whether the lists contain the same objects in different orders: sort the objects and then call SequenceEqual. … Continue reading

Posted in LINQ, lists, miscellany, OOP | Tagged , , , , , , , , , , , , , | Leave a comment

Determine whether two lists contain the same sequences of objects in C#

The IEnumerable interface provides a SequenceEqual method that determines whether two IEnumerable sequences contain the same objects. Normally, it uses reference equality so it considers two objects equal only if they refer to the same instance. However, if the objects … Continue reading

Posted in lists, miscellany, OOP | Tagged , , , , , , , , , , , | 2 Comments

Draw ransom note text in a RichTextBox in C#

This example is similar to the post Draw ransom note text in C# but it writes text into a RichTextBox instead of on a PictureBox. This has the following advantages. The code is simpler The RichTextBox can arrange text more … Continue reading

Posted in graphics, strings | Tagged , , , , , , , , , , , , | Leave a comment

Draw ransom note text in C#

This example draws each of the characters in a string in a different random font to produce a ransom note text effect. The program starts by using the following code to create arrays holding font names and brushes from which … Continue reading

Posted in graphics, strings | Tagged , , , , , , , , , , , , | 1 Comment

Find duplicate files in C#, Part 4 of 4

The last three posts described an application that searches for duplicate files and removes them. The program seems to work fairly well, at least for small test directories. When I tried it on a directory containing around 8,000 files, however, … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Find duplicate files in C#, Part 3 of 4

The last two posts described an application that searches for duplicate files and removes them. This post explains how the program removes the files when you click the Delete Selected button. When you click the button, the following code executes. … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

Find duplicate files in C#, Part 2 of 4

The previous post Find duplicate files in C#, Part 1 of 4 explained how the example uses a LINQ query to select files grouped by hash code. This post explains how the program displays the files’ contents and how the … Continue reading

Posted in algorithms, cryptography, files, system, tools | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment