I've been using C# and Visual Studio at work, but I still keep coming
back to Delphi. Here what I think Delphi has over C# and VS.
Some features I prefer/need:
sets and set operations
virtual constructors
deterministic and virtual destructors
virtual static methods
messaged based method and DefaultHandler
implementation through delegation
assign and assignto
property promotion
published section
access to source code examples of property editors, component editors, experts, design time support
full library source code
interface and implementation sections
design time binary/string properties, easy support to stream to/from dfm
class types
global level procedures and functions
block declarations
better com support
better windows api support
better visual control library
both graphic and windowed controls
onevents rather than method sounding events (click in c# vs onclick in delphi)
native code, no runtimes
asm, mmx, sse, sse2, sse3
Importantly from above organization
Block delcaration and interface/imeplementation sections really make a
difference in organizing code. With the interface section I get to see
the outline of the class/types, and with block declaration I see
everything organized in a strict order.
class
private
field
field
field
method
method
method
protected
method
method
method
property
property
property
public
constructor
destructor
method
method
property
property
published
promoted property
promoted property
promoted event
promoted event
I love the above. Delphi forces you to place fields before methods, methods before, properties, properties before events. Delphi does not put the implemenation and declaration
together, C# is nowhere near this organized. C# is a bunch of
implemenation code rolled into declaration code, usually appearing in
no organized pattern (ie.e things come in any order).
With C# you cannot block declare things such as:
const
WM_A = WM_USER;
WM_B = WM_A + 1;
WM_C = WM_B + 1;
WM_D = WM_C + 1;
Regarding class types, you can't do this in C#:
procedure ExecuteForm(FormClass: TFormClass): Boolean;
begin
with FormClass.Create(Appllication) do
try
Result := ShowModal = mrOk;
finally
Free;
end;
end;
To me, property promotion is also a big deal. I wrote a winform control
in C# recently and was quite disappointed to learn of all the derived
properties which were exposed as public which I would preferred to have
hidden.
The windows control section of is also much more powerful. The base
control, graphic control, custom control classes have so many more
methods.
Event naming in C# irks me to no end. I really want to know if
something is an event by looking a it. OnClick to me automatically
tells me, "Hey, I'm a click event", whereas Click seems to me like an
action (method) "Click the button". Then c# messes up events further
with their virtual names using On (it's Do in Delphi).
Oh, and I'm not totally sold on EventArgsTypes. It is so annoying in VS
to break open the help, searching for the an event to see the type,
clicking the type to get to the about page for the type, clicking the
EventArgsTypes, then click members, and finally learning what the
parameters actually are. In case that want click, here it is in diagram
form:
In VS highlight MouseDown in the property grid -> F1 help pops up
public event MouseEventHandler MouseDown -> click MouseEventHandler
public delegate void MouseEventHandler(Object sender, MouseEventArgs e) -> click MouseEventArgs
public class MouseEventArgs : EventArgs -> click members
MouseEventArgs Members -> scroll down past the constructor and methods inherited from system.object
Ah what type is "Button"? -> click "Button" to find public MouseButtons Button { get; }
In Delphi (using version 7 here) highlight MouseDown in the object inspector -> F1
type
TMouseEvent = procedure (Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer) of object;
Boom! Now that was a lot easier. The event has 5 parameters, and Button is type TMouseButton.
That's enough for now. You get the idea.