この記事は、一方で、私の最初の記事
「アプリケーションの移行-神話と現実」のもともと考えられていた続きであり、他方で、
クラドラフチャニー 、
ヴラドシャリコフ 、
レイア 、
ベレスが記事で尋ねたコメントのいくつかに対する答えです。
コードをDelphiからCに変換する#
まず、DelphiコードをC#コードに変換する例を示します。
Delphiコードunit Unit3; interface type TMyClass = class _str: string; constructor Create; procedure setStr(s2: string); public class var FClassField: integer; end; TMyClassD = class of TMyClass; procedure DoSomeThing; implementation procedure DoSomeThing; begin end; constructor TMyClass.Create; var c: char; i: byte; cod: integer; s: string; cls: TMyClassD; begin cls := TMyClass; inherited; DoSomeThing; Val('5', i, cod); c := '1'; s := c; end; var cls: TMyClass; s: string; procedure TMyClass.setStr(s2: string); begin s2[4] := 'a'; end; initialization cls := TMyClass.Create; s := '123456'; cls._str := s; s[3] := '0'; cls.setStr(s); end.
翻訳後、コードは次のようになります。
C#コード using System; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Data; using System.Linq; using System.IO; using System.Text; using FastCode.Delphi.Core._System; namespace Project3 { public static partial class Unit3_Module { public static void Unit3_Initialization_() { cls = TMyClass.Create(); s = "123456"; cls._str = s;
はい。移行ライブラリを接続してコンパイルすると、C#コードが機能します。
より複雑で興味深い場所があります-たとえば、名前付きで、つまりObj.Items [インデックス]の形式でアクセスできるインデックスを使用したプロパティの実装(Delphiを知っている場合-それらは理解します)が、現在このコードは手元にありません。
FoxProの外観
FoxProで小さなアプリケーションをすばやく配布したところ、次のようになりました。

以下のC#+ WPFでの外観。
申し訳ありませんが、ウィンドウタイトルのボタンとタイトルのスタイルが置き換え可能な完全なテーマを検索しませんでした
変換例に関する質問がまだある場合は、コメントしてください。
DelphiからC#へのPS変換は、コンバーターのデバッグプロセスで使用されたテストプロジェクトの1つです。
特にデモ用に、急いで作られたFoxProのPPSフォーム。