I.T. Discussion Community!
-Collapse +Expand
Prism
Search Prism Group:

Advanced
-Collapse +Expand Prism To/From
To/FromCODEGuides
-Collapse +Expand Prism Study Test
PRESTWOODCERTIFIED
-Collapse +Expand Prism Store
PRESTWOODSTORE

Prestwood eMagazine

November Edition
Subscribe now! It's Free!
Enter your email:

   ► KBPrism Knowledge Base  Print This    All Groups  

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.

Contribute an Article

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.

Posted By Mike Prestwood, Post #102037, KB Topic: Delphi Prism
  +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.

Posted By Mike Prestwood, Post #101928, KB Topic: Tool Basics
  +Add Comment  (2 Comments)




Topic: Language Basics

Same as in Delphi for Win32 but Prism also supports inline variable declaration.

Posted By Mike Prestwood, Post #101645, KB Topic: Language Basics
  +Add Comment  (2 Comments)

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.

Posted By Mike Prestwood, Post #101661, KB Topic: Language Basics
  +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.

Posted By Mike Prestwood, Post #101921, KB Topic: Language Basics
  +Add Comment  (3 Comments)

The Prism unary operators are:

+
-
Not

Posted By Mike Prestwood, Post #101896, KB Topic: Language Basics
  +Add Comment




Topic: Language Details

Like Delphi, Prism supports overloading. However, Prism supports implicit overloading (no need for an overload keyword).

Posted By Mike Prestwood, Post #101903, KB Topic: Language Details
  +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.

Posted By Mike Prestwood, Post #101753, KB Topic: OOP
  +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.

Posted By Mike Prestwood, Post #101731, KB Topic: OOP
  +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.

Posted By Mike Prestwood, Post #101836, KB Topic: OOP
  +Add Comment

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.

Posted By Mike Prestwood, Post #101848, KB Topic: OOP
  +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).

Posted By Mike Prestwood, Post #101733, KB Topic: OOP
  +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 =).

Posted By Mike Prestwood, Post #101760, KB Topic: OOP
  +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.

Posted By Mike Prestwood, Post #101735, KB Topic: OOP
  +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.

Posted By Mike Prestwood, Post #101946, KB Topic: OOP
  +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.

Posted By Mike Prestwood, Post #101794, KB Topic: OOP
  +Add Comment




Topic: Delphi for .Net Archive

use of Sender under Delphi for .NET

Posted By Joshua Delahunty, Post #100369, KB Topic: Delphi for .Net Archive
  +Add Comment

Some initial questions and answers we had as we first approached building ASP.NET applications using Delphi 2006

Posted By Joshua Delahunty, Post #100368, KB Topic: Delphi for .Net Archive
  +Add Comment

Tips on deploying ASP.NET pages written with Delphi for .NET 2006

Posted By Joshua Delahunty, Post #100373, KB Topic: Delphi for .Net Archive
  +Add Comment  (2 Comments)

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

Some initial tips on the road to using Delphi to program ASP.NET web pages.

Posted By Joshua Delahunty, Post #100366, KB Topic: Delphi for .Net Archive
  +Add Comment

Private and public variables on objects may not behave the way you'd expect, causing you to have to declare them more globally.

Posted By Joshua Delahunty, Post #100377, KB Topic: Delphi for .Net Archive
  +Add Comment


Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech