{
Pack example
This example assumes there are two edit box controls on the form. The code creates a list object and adds two strings to it. The second string in the list is a nil string. The code counts the number of strings in the list and displays the number in the Edit1 control. The code then packs the list, removing the nil string, and counts the strings in the list again. The second count displays in the Edit2 control:
} 
procedure TForm1.FormCreate(Sender: TObject);
var
  MyList: TList;
  I: Integer;
begin
  MyList := TList.Create;              {Create a list }
  MyList.Add(PChar('A string')); {Add a string}
  MyList.Add(PChar('')); { Add an empty string }
  MyList.Add(nil);              {Add nil }
  MyList.Add(PChar('')); { Add another empty string }
  Edit1.Text := IntToStr(MyList.Count); {Put count into Edit1}
  Mylist.Pack;                         {Pack the list.}
  Edit2.Text := IntToStr(MyList.Count); {Put count into Edit2}
  MyList.Free;                         {Free memory for list}
end; 
