Open House on C# 4.0 (Take 2)

October 29, 2009

Yesterday, I delivered a session titled “What’s new in C# 4.0?” after a session by Guy Burstein on “First look at Visual Studio 2010”. Thank you all for attending. I apologise for not using all the feedbacks to select winners for the books – sorry, guys! I’ll pay attention next time (probably lack of food). Some notes that came up during the session: 1. The misbehavior on the DynamicXmlElement class was due to a small oversight: I wrote this code when only one element existed: case 1:   ...
2 comments

The Return (Appearance) of the Complex Type

October 27, 2009

Early in the ads for .NET 4.0, there were rumours about two types dealing with numeric stuff, BigInteger and Complex. In the Beta 1 phase, BigInteger has appeared (I’ve briefly blogged about it), but Complex was nowhere to be found. With the advent of .NET 4.0 Beta 2, I was happy to find the emergence of the Complex type in the System.Numerics namespace (and these numeric types have been moved to their own System.Numerics.Dll assembly). Complex is, of course, represents a complex number, with a Real part and an Imaginary part. It hosts all the usual expected...
one comment

Local Kernel Debugging and LiveKd Update

Local kernel debugging is the ability to view kernel data structures in a live system (i.e. not connecting to a target system through a null cable modem or USB or other alternatives), and is supported since Windows XP. This is a great way to explore windows on its darker side (the kernel and related subsystems) with all its mysteries and secrets. With Windows XP, starting local kernel debugging is pretty easy. Just fire up WinDbg (or kd for that matter), select from the menu File->Kernel Debug, navigate to the “Local” tab, click OK and start exploring. In...
7 comments

WPF Gotcha: Default Value for a Dependency Property

October 13, 2009

When defining dependency properties in a WPF (e.g. in a user control or custom control), you can supply a default value for that property. However, if you’re not careful, you’ll get a nasty exception at runtime, with no obvious cause. For example, consider this simple dependency property: public double SomeLength {    get { return (double)GetValue(SomeLengthProperty); }    set { SetValue(SomeLengthProperty, value); } }   public static readonly DependencyProperty SomeLengthProperty =     DependencyProperty.Register("SomeLength", typeof(double), ...
tags: ,
2 comments

How to Kill Visual Studio 2008 Elegantly

October 12, 2009

Here’s an elegant (in my opinion) way to kill Visual Studio 2008 immediately without leaving any trace. Here’s what you need to do: 1. Open up VS 2008 and create a new project of type C# WPF Application. 2. Open Window1.xaml and make sure you get a split view of XAML and preview. 3. The top level layout panel is a Grid (by default). Add two rows, and in one place a button. Also name the window (e.g. “win”). The markup should be something like this: <Window x:Class="WpfApplication3.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"...
one comment