C# after Pascal


This is the start of a section to help you to apply your knowledge of Pascal when learning C#. Anders Hejlsberg, Microsoft's lead architect of C#, was formerly a designer of Borland's Turbo Pascal and the chief architect of Delphi, so we might expect some similarities in the "feel" of the languages despite the great syntax differences.

When you try a new language you will be looking out for features such as:

See this MSDN page for the many operators available in C#. Note that the ^ operator does not perform exponentiation as it does in some languages.

The next page shows a comparison table, giving the C# equivalents of fragments of Pascal code. The table on this page provides links to more than thirty of the short complete programs for which we have both Pascal/Oxygene and RemObjects C# code. We use RemObjects C# so that we can build all of these types of application: .Net console, WinForms, WPF, Windows Phone app, Java console, Java form, Java applet and Android app. You can also use RemObjects C# to target Apple devices.

It is a useful exercise to convert Pascal Programs to C#. You can see many of the changes required here.

The following table lists programs for which we have the Oxygene and RemObjects C# code for the same platform. (There are others for which we have ported the Oxygene for Java code directly to C# for .Net).

In addition, C# classes is based on our Pascal page Classes and Objects and you can compare the C# syntax of pointers with the Pascal code.

Student Program

KnockoutWhist by Luke Ashford and George Wright is available in both RemObjects C# and Oxygene for .Net. It demonstrates inheritance and advanced use of generics.


Programming - a skill for life!

Pascal Programming Tutorials