Field properties

Top  Previous  Next

What is translated > Properties > Field properties

 

There are properties in C# similar to properties in Delphi. The Delphi read and write access via properties become to get and set  property accessors in C#. The following example is taken from the Embarcadero documentation:

 

 

type

   THeading = 0..359;

   TCompass = class(TControl)

     private

        FHeading: THeading;

        procedure SetHeading(Value: THeading);

     published

        Property Heading: THeading read FHeading write SetHeading;

       // ...

    end;

->

 

public class TCompass : TControl

{

  private int /*0..359*/ FHeading;

  //# private void SetHeading(int /*0..359*/ Value);

  /*property Heading : THeading read FHeading write SetHeading;*/

  public int /*  0..  359*/ Heading

  {

    get

    {

      return FHeading;

    }

    set

    {

      SetHeading(value);

    }

  }

       // ...

};

 

C# also has e pendant to Delphi's default

.



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content