WPF Sample, badly done
Tigraine
Daniel Hoelbling talks about programming and technology

WPF Sample, badly done

June 12, 2009 by Daniel Hoelbling

While trying out some WPF, I ended up downloading this code sample on Drag&Drop that contained the following piece of code:

if (e.Source == MyCanvas)
{
}
else
{
    _isDown = true;
    _startPoint = e.GetPosition(MyCanvas);
    _originalElement = e.Source as UIElement;
    MyCanvas.CaptureMouse();
    e.Handled = true;
}

Come on? I’ve seen 6 year olds that knew the use of != and ==.

Please Microsoft: Documentation is as important as shipping code. At least review what crap is getting put out there. It just looks bad to say the least.