Something I heard yesterday made me think about the aspect of performance, when deciding whether to use interfaces or delegates to implement a specific feature. For example, when implementing the Observer pattern, the classic approach involves interfaces, while .NET has support for (multicast) delegates natively, suggesting a builtin approach that might make more sense in a .NET language.
To make this decision, there are of course many arguments to consider — most importantly, when talking ab …
WinFS beta 1 is available, as I’m sure I’m not the first to report. I just watched this new Channel9 video about WinFS, which has a few really good demos and a lot of talk about WinFS. Highly recommended!
I heard criticism about my first post on the topic: if a control was on the form, apart from the background drawing, the rubber rectangle would appear behind the control, not in front of it. Of course there are several ways to change this, I decided to implement one of them just for fun :-) This is what things look like before and after my changes:
Here’s the complete …
I saw the question coming up in a newsgroup today: how do you draw a selection rubber band just like the one Explorer uses, in C#? The first thing that came to mind was the ControlPaint.DrawReversibleFrame() method, but that’s rather restricted. It’s fine to draw a rectangle around an area to select, but it can’t do anything more than that and it also has problems because it draws over windows that are supposed to be in front of the current app window. Here are screenshots of a selection made i …
I recently saw this question regarding the use of methods that get passed delegates — specifically, the .NET 2 collection classes make use of this, like for example the List<T>
class, which takes a Predicate<T>
as a parameter to its Find
method. Now the question is how to make use of this method? How does the delegate know what to do when it’s called?
As I see it, there are two (good) approaches to this: using an anonymous method and using a separate class. I’m going to illustrate both …
I guess you know the way you can define aliases with the using statement:
using SWF = System.Windows.Forms;
Then you can use the shortcut SWF
to reference a type in the namespace. In C# 1, the syntax was like this:
SWF.Button button = new SWF.Button();
Obviously this could be ambiguous, because there could have been any kind of different identifier in scope called SWF. To get rid of this ambiguity, C# 2 introduced the ::
qualifier. So now you’ll write the sam …
TestComplete by AutomatedQA is a tool for automated testing, useful in many software testing scenarios ranging from internal unit testing to black box UI testing. The next major version 4 has been in the making for a while now and they still don’t announce a release date, but every now and then they make previews of various new features available (for example on their new community site). The latest thing that caught my eye was that OCR is going to come to automated testing in TestComplete 4. F …
This blog article explains that, and why, a late change to the implementation of nullable types is being made in the runtime, making nullables an intrinsic type. This solves the problems that many had reported when nullables were used in situations where boxing occurred, and where null comparisons were made involving generic types. Read the original article for the details, this is good news!