| |
KB Article |
|
|
Mike Prestwood
|
1. Delphi Prism Member Events (event)
Like all .Net languages, Prism events are a separate type of class member. You define a member event by using the event keyword. Events depend on Delegates to define the signature (the type) of the event they represent and they maintain a list of multiple subscribers - unlike in Delphi for Win32, where each event can only have one handler
|
 Code
 1509 Hits
|
 Delphi Prism
|
Mike Prestwood
|
2. Delphi Prism Event Handler
The Delphi Prism
Most notable for Delphi developers is the fact that Prism does not offer initialization nor finalization sections.
|
 Code
 2496 Hits
|
 Delphi Prism
|
Mike Prestwood
|
3. Delphi Prism Empty String Check (length)
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.
|
 Code |
 KB Post |
 2123 Hits
|
 Delphi Prism
|
Mike Prestwood
|
4. Delphi Prism Polymorphism
Prism supports the following types of polymorphism:
34 months ago, and updated 32 months ago
(1 Comments
, last by mtiede )
|
 Code
 2039 Hits
|
 Delphi Prism
|
Mike Prestwood
|
5. Delphi Prism Pointers
Although pointer data types in Prism coding are less important than in other languages such as C++, Prism does support developer defined pointers. Use the ^ operator to declare a pointer data type. Use the @ operator to return the current address of a variable.
In .Net managed coding the use of pointers is not safe because the garbage collector may move memory around. To safely use pointers, use the unsafe keyword. However, avoid unsafe code if possible.
|
 Code
 2696 Hits
|
 Delphi Prism
|
Mike Prestwood
|
6. Share Code with Delphi and Prism
Can I share code between a Delphi and a Dephi Prism project? I want to have a single source Win32 and .Net application.
|
 FAQ |
 KB Post |
 1617 Hits
|
 Delphi Prism
|
Mike Prestwood
|
7. Delphi Prism Overriding (virtual, override)
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.
|
 Code |
 Article |
 1977 Hits
|
 Delphi Prism
|
Mike Prestwood
|
8. Delphi Prism Self Keyword (Self)
Within the implementation of a method, the identifier Self references the object in which the method is called. The Self variable is an implicit parameter for each object method. A method can use this variable to refer to its owning class.
|
 Definition
 1582 Hits
|
 Delphi Prism
|
Mike Prestwood
|
9. Oxidizer
Oxidizer is a free tool that (in combination with ShineOn) is provided to help to port Delphi (Win32 and .NET) projects to the Delphi Prism language. Oxidizer is a command line tool that will adjust your .pas source files for common differences between the two languages.
|
 Download
 2200 Hits
|
 Delphi Prism
|
Mike Prestwood
|
10. ShineOn
A Delphi Prism implementation of the Delphi for Win32 RTL.
|
 Download
 1712 Hits
|
 Delphi Prism
|
Mike Prestwood
|
11. Delphi Prism Class Contracts (require, ensure)
Prism supports class contracts with its require and ensure keywords. The require keyword is a pre condition that must be true when the method is called. The ensure keyword is a post condition that much be true when a method exits. With either, if the condition evaluates to false, then an assertion is generated.
They can be used to check for the validity of input parameters, results, or for the state of the object required by the method.
The require and ensure keywords will expand the method body to list the preconditions; both sections can contain a list of Boolean statements, separated by semicolons.
|
 Code
 1487 Hits
|
 Delphi Prism
|
Mike Prestwood
|
12. Delphi Prism Left of String (Substring)
Delphi Prism Left of String
|
 Code
 2034 Hits
|
 Delphi Prism
|
Mike Prestwood
|
13. Delphi Prism String Concatenation (+)
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.
35 months ago, and updated 28 months ago
(3 Comments
, last by mtiede )
|
 Code |
 KB Post |
 2265 Hits
|
 Delphi Prism
|
Mike Prestwood
|
14. Delphi Prism Logical Operators
Prism logical operators:
| and |
and, as in this and that |
| or |
or, as in this or that |
| not |
Not, as in Not This |
| xor |
either or, as in this or that but not both |
|
 Code
1614 Hits
|
 Delphi Prism
|
Mike Prestwood
|
15. Delphi Prism Exception Trapping (try..except, try..finally)
Use a try..except..end block to trap and process errors.
|
 Code
 2891 Hits
|
 Delphi Prism
|
Mike Prestwood
|
16. The Delphi Prism Primer
http://prismwiki.codegear.com/en/The_Prism_Primer
|
 Link
 1350 Hits
|
 Delphi Prism
|
Mike Prestwood
|
17. Delphi Prism Deployment Overview
Prism projects require the .Net framework and any additional dependencies you've added such as Crystal Reports.
In Visual Studio.Net, you can create a Setup and Deployment project by using any of the templates available on the New Project dialog (Other Project Types).
Prism doesn't directly support ClickOnce. At least not yet. In other words, there isn't a Security tab on the solution properties dialog. To create a ClickOnce deploy package, search the internet for mage.exe and mageui.exe.
In addition, you can use any of the many free and commercially available installation packages.
|
 Code
 1422 Hits
|
 Delphi Prism
|
Mike Prestwood
|
18. Delphi Prism Overloading (implicit)
Like Delphi, Prism supports overloading. However, Prism supports implicit overloading (no need for an overload keyword).
|
 Code |
 KB Post |
 2074 Hits
|
 Delphi Prism
|
Mike Prestwood
|
19. Delphi Prism Unary Operators
The Prism unary operators are:
35 months ago, and updated 35 months ago
|
 Code |
 KB Post |
 1757 Hits
|
 Delphi Prism
|
Mike Prestwood
|
20. Delphi Prism Prevent Derivation (sealed, final)
Same keywords as Delphi (sealed uses slightly different syntax). With Prism, use the sealed keyword before the class keyword to prevent a class from being inherited from and use the final keyword to prevent a method from being overridden.
|
 Code
1936 Hits
|
 Delphi Prism
|
Mike Prestwood
|
21. Delphi Prism Inlining (Automatic)
In Prism, inlining is automatically done for you by the JIT compiler for all languages and in general leads to faster code for all programmers whether they are aware of inlining or not.
|
 Code
1710 Hits
|
 Delphi Prism
|
Mike Prestwood
|
22. Delphi Prism Assignment (:=)
Same as Delphi.
|
 Code
 1463 Hits
|
 Delphi Prism
|
Mike Prestwood
|
23. Delphi Prism Finalizer (finalize())
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.
36 months ago, and updated 28 months ago
|
 Code |
 Article |
2131 Hits
|
 Delphi Prism
|
Mike Prestwood
|
24. Partial Methods versus Abstract Methods
What is the difference between a partial method and an abstract method?
|
 FAQ
 1537 Hits
|
 Delphi Prism
|
Mike Prestwood
|
25. Delphi Prism Constructors (constructor + class name)
Prism uses unnamed constructor methods for constructors. Prism also supports a Create constructor method for backward compatibility with Delphi for Win32.
36 months ago, and updated 35 months ago
|
 Code |
 Article |
2609 Hits
|
 Delphi Prism
|