Ver Mensaje Individual
  #16  
Antiguo 31-03-2016
Avatar de AgustinOrtu
[AgustinOrtu] AgustinOrtu is offline
Miembro Premium
NULL
 
Registrado: ago 2013
Ubicación: Argentina
Posts: 1.858
Reputación: 15
AgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en bruto
Hola jhonny

El metodo ElementAt es para acceder al elemento mediante un indice

Cita:
/// <summary>
/// Returns the element at a specified index in a sequence.
/// </summary>
/// <param name="index">
/// The zero-based index of the element to retrieve.
/// </param>
/// <returns>
/// The element at the specified position in the source sequence.
/// </returns>
function ElementAt(index: Integer): T;
Podria decirse que es el equivalente a la propiedad indizada Items de las coleciones de la RTL

Código Delphi [-]
uses
  Generics.Collections;

var
  list: TList< Integer >;
begin
  list := TList< Integer >.Create;
  try
    list.AddRange([1, 2, 3]);
    ShowMessage(list.Items[1].ToString); // imrpime 2
  finally
   list.Free;
  end; 
end;

Usando Spring:

Código Delphi [-]
uses
  Spring.Collections;

var
  list: IList< Integer >;
begin
  list := TCollections.CreateList< Integer >;
  list.AddRange([1, 2, 3]);
  ShowMessage(list.Items[1].ToString); // imrpime 2
  ShowMessage(list.ElementAt(1).ToString); // imrpime 2
Responder Con Cita