Watch, Follow, &
Connect with Us

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




ID: 25066, Nice T prefix for .NET 2 classes with some compile time packages

by Mauro Venturini Email: Anonymous


.NET 2 classes with nice T prefix, some compile time packages is all what is needed.
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 11.0  to 11.0 26 downloads
Copyright: No significant restrictions


Terms of use: Embarcadero use at your own risk disclaimer


Size: 1,008,321 bytes
Updated on Fri, 12 Oct 2007 05:11:57 GMT
Originally uploaded on Fri, 12 Oct 2007 05:12:00 GMT
SHA1 Hash: EB0133371ADFF14ED8DB94C6DD44552053B9EDF1
MD5 Hash: F4BF0A45AA71A8878E987923CC61FFEA

    Explore the files in this upload

Description
SystemT V2.0.50727.42 (RAD Studio 2007 ready)
.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 has the solution: type equivalence, e.g.
type
TGraphics = System.Drawing.Graphics;
var
Graphics: TGraphics;
The type equivalence definitions for the .NET framework can be generated automatically using a tool as PrefixIt! (it can be downloaded at http://cc.codegear.com/Item/22872) and some packages built from them: SystemT0.dll, SystemT1.dll and SystemT2.dll (the number of .NET 2 types is too larger for a single assembly).
Now to use inside your application or package these new names for the .NET framework types you have to:
1. Add references to SystemTx.dll packages removing both the "Copy Local" and the "Link in Delphi Units" options;
2. For every namespace N that you want to use inside a unit add N AND N.T to the uses clause.
That's all.

   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