Declaration

Top  Previous  Next

New features since Delphi 7 > Generics > Declaration

 

 

type

   TPair<TKey,TValue> = class

 

   private

     FKey: TKey;

     FValue: TValue;

   public

     function GetKey: TKey;

     procedure SetKey(key: TKey);

     function GetValue: TValue;

     procedure SetValue(Value: TValue);

     property key: TKey Read GetKey Write SetKey;

     property Value: TValue Read GetValue Write SetValue;

   end;

 

implementation

 

function TPair<TKey,TValue>.GetValue: TValue;

 begin

   Result := FValue;

 end;

 

 

->

 

 

public class TPair<TKey, TValue> : TObject

{

  public TKey FKey;

  public TValue FValue;

  public TValue GetValue()

  {

    TValue result;

    result = FValue;

    return result;

  }

 

  public TPair() {}

};

 

 

 

 

 

 

 

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content