Comments |
Top Previous Next |
What is translated > File layout > Comments
All comments are output essentially unchanged at the corresponding positions. Line comments remain totally unchanged, while bracketing is translated from
{...} or (*...*) to
/*...*/
Sometimes there are difficulties to output comments at the desired positions. The following example shows on the right side what Delphi2C# does with the Delphi source on the left side:
unit comments; using static comments.commentsInterface; using static comments.commentsImplementation; using System; interface using static System.SystemInterface;
namespace comments type { TFoo = class public class TFoo : TObject private { function foo : boolean; end; /*------------------------- Name : Result : ---------------------------*/ private bool foo() { bool result = false; result = true; return result; }
public TFoo() {} };
/*------------------------- Name : Foo2 Result : ---------------------------*/ function foo2: boolean; public static bool foo2() { bool result = false; return result; }
} // class commentsInterface
implementation public class commentsImplementation var { bar : integer = 0; // comment to bar public static int bar = 0; // comment to bar (*------------------------- Name : } // class commentsImplementation Result : ---------------------------*) } // namespace comments function TFoo.foo: boolean; begin result := true; end;
(*------------------------- Name : Foo2 Result : ---------------------------*) function foo2: boolean; begin end;
end.
The Delphi member function declaration foo and its definition in C# are combined into one text at the position of the original declaration. A comment before the definition has to be shifted to that place too. The same applies to the declaration and definition of the free function foo2. The comment to the variable bar is output directly behind of the variable declaration. Sometimes Delphi2C# cannot clearly decide, which comment line belongs to a multi line comment in front of a function definition and a comment which explains an entity afterwards. For the second case Delphi2C# only takes single line comments, which follow directly on a statement.
|
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |