Try n times

A method to call another method n times or until it returns true (success). Used to talk to wireless devices in a noisy environment where each call has a chance of failure. bool Try(uint n, Func<bool> func) { int i = (int)(n == 0 ? 1 : n); do { if (func()) return true; i–; […]

Continue reading

Update to SortableBindingList

I’ve been a using this implementation of the SortableBindingList by Tim Van Wassenhove for a few years now but recently I noticed that although making a change to the list updated all bound controls it did not update the backing collection. I switched back to a standard BindingList<T> in an attempt to resolve the issue and […]

Continue reading

Comparing performance of GDAL and Proj.NET

There are two major free/open source projection libraries available for use under .NET: GDAL and Proj.NET. GDAL has a long history, and is written in C++, so it’s compiled to machine code. The C# bindings are generated by a tool. Calling C++ from C# uses a process called “pinvoke” (Platform Invoke), and a certain amount […]

Continue reading

QuadTree

Introduction A QuadTree is a spatial partitioning strategy used to make queries on relationships between 2D spatial data such as coordinates in a Geographic Information System (GIS), or the location of objects in a video game. For instance, you may need to know all the objects within a region on a map, test whether objects are visible by […]

Continue reading