Interfaces

Top  Previous  Next

What is translated > Types > Records, Classes, Interfaces > Interfaces

 

In Delphi interface types can be defined like in the following lines of code:

 

 

IConverter = interface

  ['{GUID}']

  function convert(Source : String): String;

end;

 

TConverter = class(TInterfacedObject, IConverter)

public

  //...

  function convert(Source : String): String;

end;  

 

 

C# also knows this keyword, but the GUID has to be written differently:

 

 

[Guid("GUID"), ComVisible(true)]

public interface IConverter : IInterface

{

  string convert(string Source);

};

 

public class TConverter : TInterfacedObject, IConverter

{

 

  //...

  public string convert(string Source)

  {

  ...

};

 

All Interfaces inherit from at least from IInterface.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content