Tag Archives: dictionary

Make a case-insensitive dictionary in C#

The example Use a Dictionary to store and retrieve items in C# shows how to use a dictionary to store and retrieve values with keys. By default the Dictionary class is case-sensitive so the keys “Rod Stephens” and “rod stephens” … Continue reading

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

Use a Dictionary to store and retrieve items in C#

This example demonstrates a Dictionary. A Dictionary is basically a strongly typed Hashtable. A Hashtable stores key/value pairs in a way that makes looking up values extremely fast. For example, suppose you have an employee database that uses EmployeeId values … Continue reading

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

Use LINQ to select words of certain lengths from a file in C#

This example uses LINQ to read a file, remove unwanted characters, select words of a specified length, and save the result in a new file. Recently I needed a big word list so I searched around for public domain dictionaries. … Continue reading

Posted in algorithms, files, LINQ | Tagged , , , , , , , , , , , | 2 Comments

Initialize a Dictionary in C#

The post Initialize two-dimensional arrays in C# explains how to initialize a two-dimensional array. Even though a Dictionary is a more complicated data type, you can use a similar method to initialize one. Simply enclose each of the Dictionary‘s key/value … Continue reading

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

Use a dictionary to draw a 3D Menger sponge fractal more efficiently using WPF, XAML, and C#

The example Draw a 3D Menger sponge fractal using WPF, XAML, and C# shows how to build a Menger sponge. That example recursively chops up cubes and discards pieces of them until it reaches a desired level of recursion. At … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Create a 3D surface really quickly with WPF, XAML, and C#

The example Draw a smooth 3D surface with WPF, XAML, and C# draws a smooth surface but take about 16 seconds on my computer. The example Create a 3D surface more quickly with WPF, XAML, and C# searches for duplicate … Continue reading

Posted in algorithms, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Create a 3D surface more quickly with WPF, XAML, and C#

IMHO I think the example Draw a smooth 3D surface with WPF, XAML, and C# is pretty cool. Unfortunately it’s also a bit slow. It takes around 16 seconds to generate the three-dimensional scene. The program is generating 10,000 points … Continue reading

Posted in algorithms, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Draw a smooth 3D surface with WPF, XAML, and C#

My post Draw a 3D surface with WPF, XAML, and C# explains how to use WPF, XAML, and C# to draw a three-dimensional surface. The following list recaps the main steps. Place a Viewport3D object on a WPF program’s window. … Continue reading

Posted in algorithms, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | 3 Comments

Understand three-dimensional drawing with WPF, XAML, and C#

The previous examples I’ve posted that use XAML to draw three-dimensional objects are pretty cool, but they’re really basically toys. You can sit down and work out the coordinates needed to draw a cube or (with a bit of work) … Continue reading

Posted in algorithms, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Make an extender provider that validates required TextBoxes in C#

An extender provider provides properties and services for other controls and components on a form. For example, the ToolTip component is an extender provider. When you add one to a form, the other controls on the form get a new … Continue reading

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