Monthly Archives: May 2016

Find a matrix inverse in C#

This example finds a matrix inverse for a square matrix. The inverse of a matrix is another matrix that, when multiplied by the first, gives the identity matrix as a result. In the identity matrix, all entries are 0 except … Continue reading

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

Use the Conditional attribute to make a method non-callable in C#

The Conditional attribute makes a method callable depending on whether a compile-time constant is defined. If the constant is not defined, then the compiler ignores calls to that method. The following code makes the Test subroutine callable if either the … Continue reading

Posted in attributes, debugging | Tagged , , , , , , , , | Leave a comment

Draw smoother cones using WPF and C#

The example Draw smooth cones using WPF and C# shows how to draw some fairly smooth cones in WPF and C#. This example shows how to make even smoother cones. In the picture on the right, the cone on the … Continue reading

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

Draw smooth cones using WPF and C#

The example Draw cones using WPF and C# shows how to draw cones in WPF and C#. This example shows how to draw smooth cones. Or at least smoother cones. To make smooth cones, the program simply ensures that adjacent … Continue reading

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

Draw cones using WPF and C#

This example shows how to draw cones in WPF and C#. The program uses a method very similar to the one used by the example Draw cylinders using WPF and C#. The picture on the right shows the approach used … Continue reading

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

Make a temperature forecast in C#

The example Get weather forecast data in C# explains how to read weather forecast data from OpenWeatherMap. This example uses that data to list the forecast’s temperatures. The forecast data has (in part) the following structure. <weatherdata> … <forecast> <time … Continue reading

Posted in internet, interoperability, web, XML | Tagged , , , , , , , , , , , , | 5 Comments

Get weather forecast data in C#

There are many sites that offer weather condition and weather forecast services. All of the ones I found required you to have a developer key, although most of them have a free membership that works for a simple program like … Continue reading

Posted in internet, interoperability, web, XML | Tagged , , , , , , , , , , | Leave a comment

Graph historical stock prices in C#

The key to this example is the GetStockPrices method shown in the following code. // Get the prices for this symbol. private List GetStockPrices(string symbol) { // Compose the URL. string url = “http://www.google.com/finance/” + “historical?output=csv&q=” + symbol; // Get … Continue reading

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

Give an application beautiful icons in C#

This is a pretty long tutorial on how to build and use icons in an application. Contents Icon Sizes Creating an Icon File Using the Integrated Icon Editor Using External Icon Editors Inkscape @icon sushi Using an Icon File Clearing … Continue reading

Posted in forms, graphics, system | Tagged , , , , , , , | 1 Comment

Provide multiple inheritance in C#

Sometimes you might want a class to inherit from more than one parent class. For example, you might define a Vehicle class that has vehicle properties such as MaxSpeed, and a Domicile class with house-like properties such as SquareFeet. You … Continue reading

Posted in inheritance, interfaces, OOP | Tagged , , , , , , , , , | Leave a comment