[Overview][Classes][Procedures and functions][Index] Reference for unit 'LazMethodList' (#lazutils)

TMethodList.Add

Adds the specified method to the list.

Declaration

Source position: lazmethodlist.pas line 54

public procedure TMethodList.Add(

  const AMethod: TMethod

);

procedure TMethodList.Add(

  const AMethod: TMethod;

  AsLast: Boolean

);

Arguments

AMethod

  

Method to add to the list.

Arguments

AMethod

  

Method to add to the list.

AsLast

  

Indicates if the method should be appended to the end of the list.

Description

Add is an overloaded procedure used to add the TMethod instance specified in AMethod to the Items in the list. Add uses the value in AllowDuplicates to determine if the Items in the list need to be checked for duplicates prior to adding the specified method. When AllowDuplicates is False, the IndexOf method is used to locate an existing entry in Items with the method in AMethod. If the method does not exist in Items, or AllowDuplicates is True, the method in AMethod is appended to the end of the memory allocated to the Items property. ReAllocMem is used to set the new size for the memory allocation.

Add ensures the internal member used for the Count function is incremented when necessary.

An overloaded variant of the Add method includes the AsLast parameter. AsLast indicates if the position in items where the new method is stored. When AsLast is True, the method in AMethod is appended to the end of allocated memory using the Add method. When AsLast contains False, the Insert method is called to store the new method at the beginning of allocated memory.

See also

TMethodList.AllowDuplicates

  

Indicates if duplicate methods are allowed in the list.

TMethodList.IndexOf

  

Gets the position where the specified method is stored in the list.

TMethodList.Count

  

Gets the number of items included in the method list.

TMethodList.Insert

  

Inserts the specified method at the given position in the list.


Version 4.0 Generated 2025-05-03 Home