Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.




ID: 22872, PrefixIt!, a tool to use T prefixed names for .NET 2 classes

by Mauro Venturini Email: Anonymous


PrefixIt!, a tool to make possible the use of T prefixed names for .NET classes (now for .NET 2)
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 9.0  to 11.0 131 downloads
Copyright: Commercial use requires permission


Terms of use: Embarcadero use at your own risk disclaimer


Size: 1,800,246 bytes
Updated on Fri, 12 Oct 2007 04:35:07 GMT
Originally uploaded on Fri, 10 Dec 2004 00:37:44 GMT
SHA1 Hash: D94A6BAB7106C69D018F079CF8862D877767E946
MD5 Hash: DA9C9833D680F440F09908CCC7D60806

    Explore the files in this upload

Description
PrefixIt! V7.0
.NET framework is nice indeed. I like it, and I am a Delphi "integralist". Unfortunately, someone in MS decided that interface name prefix 'I' is good but class name prefix ('T' or 'C') it is not. This has unpleasant consequences.
1 - It decreases code clarity, e.g. is that a class or an instance reference?
2 - It makes often necessary to use the full type name because of clashing with some property, e.g. every form has a DialogResult property so if you want to test for a DialogResult type value you end up writing "if AForm.DialogResult = System.Windows.Form.DialogResult.OK then"
3 - It makes instance naming a pain, e.g. as I can not call it Graphics should I call it AGraphics, MyGraphics, _Graphics, argh! C# chaps have a case-sensitive solution: they uncapitalize the instance names, e.g. Graphics graphics = new Graphics; Very readable indeed! Not to mention the problem if the instance is visible outside the assembly (.NET in general is NOT case-sensitive).
Delphi would have the solution: type equivalence, e.g.

type
TGraphics = System.Drawing.Graphics;
var
Graphics: TGraphics;

but manually rename all framework types is not an option.
Fortunately, using reflection it is quite easy to develop a tool that inspects one or more assemblies and generate units with all the required type definitions.
These type definition bunches are also a nice place where to put some helper types, especially dynamic arrays of base types that are necessary for object casting due to a quirk of Delphi sintax: casting directly to a dynamic array does not compile. e.g.

type
TStringArray = array of string;
var
e: TDragEventArgs
Drops: TStringArray;
//This compiles
Drops := e.Data.GetData(TDataFormats.FileDrop) as TStringArray;
//This does not
Drops := e.Data.GetData(TDataFormats.FileDrop) as array of string;

PrefixIt! V7.x is a .NET 2 application and supports .NET 2 only (last .NET 1.1 version of PrefixIt! (V6.1) is included too).

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03