We just had a problem with data that is sent to SQL Server as a XML string. One of the values sent to the SQL Server is defined in the C# class as a double and interpreted as a 'DECIMAL(28, 9)' on the SQL Server. This was working so far. Just wen someone entered a quite small number (0.000013) it stopped working. The reson: 1.3E-05 is sent to the SQL Server and it can’t interprete this. It COULD be parsed on the SQL Server, although would involve some floting point madness that could mess up the ......
While refactoring an application today, I had to configure a couple of ComboBoxes programmaticaly. To simplify this, I cam up with the following piece of code. public class ComboboxBinder { //---- Members ---------------------------... private readonly ComboBox _combobox; //-------------------------... private ComboboxBinder(ComboBox comboBox) { _combobox = comboBox; } //-------------------------... public static ComboboxBinder ......
As you might have seen, there has been some blogging about named format strings in the last days. Fun With Named Formats, String Parsing, and Edge Cases (Phil Haack) Named Formats Redux (Phil Haack) Named Format Strings(James.ToString()) If you didn't came across it, the general idea is to use something like: "foo '{foo}' bar: {bar}".Format(new {foo = "abc", bar= 123}) Since I already had an analog solution for this problem I thought it would be fun to run it in 'competition' with the other implementations. ......
Easy deferred execution While programming, especially in GUI applications, you may have come across the problem of actions that take too long to run them in the foreground thread (aka GUI thread). .Net brings a couple of different possibilities to circumvent this, for example the ThreadPool, BackGroundWorker or the Dispatcher class in WPF. What they have in common is, that they clutter up your code. Especially, if your are trying to separate your concerns you should think of a better solution. One ......