Delphi Prism Tech Articles
These Articles are contributed by you (our online community members). They are organized by our knowledge base topics. Specifically, by the Prism sub-topics.
|
22 Delphi Prism Articles
Group: Delphi Prism
Topic: Delphi Prism
In Prism, a string can be nil (unassigned), assigned an empty string (""), or assigned a value. Therefore, to check if a string is empty, you have to check against both nil and (""). Alternatively, you can check the length of the string or use String.IsNullOrEmpty.
+Add Comment
Topic: Tool Basics
Can I share code between a Delphi and a Dephi Prism project? I want to have a single source Win32 and .Net application.
+Add Comment
( 2 Comments)
Topic: Language Basics
In Prism, everything is within a class (just like with C#, VB.Net, and Java). So you create class methods using the method keyword. Alternatively, you can use procedure or function if you want the compiler to enforce returning or not returning a value.
+Add Comment
Unlike Delphi, Prism performs implicit casting. To concatenate two strings, a string to an integer, or a string to a floating point number, use the + operator. For example, to convert a floating point number to a string just concatenate an empty string to the number as in "" + 3.2.
+Add Comment
( 3 Comments)
Topic: Language Details
Like Delphi, Prism supports overloading. However, Prism supports implicit overloading (no need for an overload keyword).
+Add Comment
Topic: OOP
Prism supports abstract class members and abstract classes using the abstract keyword. An abstract class is a class with one or more abstract members and you cannot instantiate an abstract class. However, you can have additional implemented methods and properties. An abstract member is either a method (method, procedure, or function), a property, or an event in an abstract class. You can add abstract members ONLY to abstract classes using the abstract keyword. Alternatively, you can use the empty keyword in place of abstract if you wish to instantiate the abstract class.
+Add Comment
Declare your class in the Interface section. Then implement the class in the Implementation section. To create an object instance, use the New keyword. Optionally, you can use Create for backword compatibility with Delphi if you turn it on in the compatibility options. Since Prism does have a garbage collector, you do not have to free the object. If you need to free either unmanaged resources or resources where "timing" is important, implement IDisposable and take control of freeing the object yourself using Dispose.
+Add Comment
( 1 Comments)
Prism uses unnamed constructor methods for constructors. Prism also supports a Create constructor method for backward compatibility with Delphi for Win32.
+Add Comment
( 1 Comments)
Unlike Delphi, Delphi Prism uses the .Net garbage collector to free managed object instances. Prism does not have nor need a true destructor.
In .Net, a finalizer is used to free non-managed objects such as a file or network resource. Because you don't know when the garbage collector will call your finalizer, Microsoft recommends you implement the IDisposable interface for non-managed resources and call it's Dispose() method at the appropriate time.
+Add Comment
With Prism, you use the Interface keyword to define an interface and then you include one or more interfaces where you specify the single class inheritance (separated by commas).
+Add Comment
( 1 Comments)
In Prism you can set the visibility of a member field to any visibility: private, protected, public, assembly and protected or assembly or protected. Prism supports the readonly modifier for member fields which is handy for constant like data. In this case, I chose not to preface my read-only member field with "F" so it's usage is just like a read-only property. Prism also support the class modifier (static data) for member fields. Delphi developers should notice the use of := to initialize a member field (in Delphi you use an =).
+Add Comment
( 1 Comments)
Prism supports a full suite of member modifiers. Prism virtuality modifiers are virtual, override, final, and reintroduce. Prism general modifiers are abstract, empty, async, external, locked, unsafe, implements, and iterator. Not all member types support all member modifiers. For example, member fields support only readonly and implements.
+Add Comment
Same as Delphi. In Prism, you specify a virtual method with the virtual keyword in a parent class and replace it in a descendant class using the override keyword. Call Inherited in the descendant method to execute the code in the parent method.
+Add Comment
Prism supports both partial classes and partial methods using the keyword partial. A partial method is an empty method defined in a partial class.
+Add Comment
Topic: Delphi for .Net Archive
Some initial questions and answers we had as we first approached building ASP.NET applications using Delphi 2006
+Add Comment
Delphi 8 fix for Required package Borland$ not found caused by the .Net Framework service pack 1 update.
Posted By Mike Prestwood,
Post #100270, KB Topic: Delphi for .Net Archive
+Add Comment
( 21 Comments)
Private and public variables on objects may not behave the way you'd expect, causing you to have to declare them more globally.
+Add Comment
|
|