Corrected downcasting logic: in C#, "foo = bar as Duck" will set foo to null if bar cannot downcast to type 'Duck'.