FranzB 0 Posted November 2, 2021 which unit contains the TArray class , I*m using Delphi 10.4 not working units : System.Generics.Collections.TArray, System.TArray, Share this post Link to post
Rollo62 536 Posted November 2, 2021 Both: https://docwiki.embarcadero.com/Libraries/Sydney/en/System.TArray is defined as type TArray = array of T; and https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Generics.Collections.TArray contains the generic version of the array var LDest : TArray< Integer >; begin SetLength( LDest, 2 ); LDest[ 0 ] := 111; LDest[ 1 ] := 222; Share this post Link to post
Stefan Glienke 2002 Posted November 2, 2021 (edited) If you mean the TArray class with the Sort methods and so on then it's System.Generics.Collections. TArray<T> in System is not a class but a dynamic array declaration. Edited November 2, 2021 by Stefan Glienke 1 Share this post Link to post
FranzB 0 Posted November 2, 2021 I want to compile this test code below for regular expressions, but none uses option works for me ... error [dcc32 Fatal Error] ..... .pas(10): F2613 Unit 'System.Generics.Collections.TArray' not found. uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types, FMX.StdCtrls, FMX.ScrollBox, FMX.Memo, FMX.Controls.Presentation, FMX.Edit, // System.Generics.Collections.TArray, // System.TArray, System.RegularExpressions;; ..... procedure TForm2.Button_evalregexpressionsClick(Sender: TObject); var regex: string; analysistxt: string; list: TArray<string>; item: String; begin regex := Edit_regexp.Text; analysistxt := Edit_analysisText.Text; list := TRegEx.Split(analysistxt, regex); for item in list do begin ShowMessage(item); end; end; end. Share this post Link to post
darnocian 84 Posted November 2, 2021 I'm not sure if think you might be thinking that 'uses' works similarly to the 'import' statement in Java. In Java, you normally import the type from the fully qualified package as you have attempted. 'System.Generics.Collections' is the unit, with many types/functions defined within. if you just needed to use it, you simply do 'uses System.Generics.Collections;' From the online help, if you see something like 'System.Generic.Collections.TArray' - it normally means that 'TArray' will be defined in 'System.Generics.Collections', so you 'uses' as illustrated above. Share this post Link to post
Remy Lebeau 1394 Posted November 3, 2021 (edited) 19 hours ago, FranzB said: error [dcc32 Fatal Error] ..... .pas(10): F2613 Unit 'System.Generics.Collections.TArray' not found. The non-generic TArray is a type in the System unit, and the generic TArray<T> is a type in the System.Generics.Collections unit. The uses clause is used to specify units only, not types. TArray is not its own unit, so don't specify TArray in your uses clause, eg you need to change 'System.Generics.Collections.TArray' to just 'System.Generics.Collections' in the uses clause. But don't change 'System.TArray' to 'System', just drop it entirely, as specify 'System' by itself in a uses clause will cause a compiler error (the System unit is already used implicitly in every unit). Edited November 3, 2021 by Remy Lebeau Share this post Link to post
FranzB 0 Posted November 3, 2021 thanks, the issue is now solved ... did too much coding in JAVA as well 🙂 Share this post Link to post
Fr0sT.Brutal 900 Posted November 8, 2021 On 11/3/2021 at 7:23 PM, Remy Lebeau said: The non-generic TArray is a type in the System unit, and the generic TArray<T> is a type in the System.Generics.Collections unit. TArray<T> = array of T; XE2's System.pas... Share this post Link to post