more operator overloading

Top  Previous  Next

New features since Delphi 7 > Operator Overloading > more operators


In Delphi there the operators Round, Trunc and In, which have no counterparts in C#. These operators are defines as static member functions in C#.




public static long Round(TOperatorClass Value)


  long result = 0;

  result = (long) Math.Round(((double) Value), 0); // cast to double prevents from cycle

  return result;




At positions, where these operators are used, Delphi2C# creates explicit calls to the member function. For example:




  x: TMyClass;

  d : Double;


  d := Round(x);



becomes to:


TMyClass X = {0};

double d = 0.0;


d = TMyClass.Round(X);







This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content