Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wish: populate collections from arrays/containers #76

Closed
the-Arioch opened this issue Aug 24, 2016 · 1 comment
Closed

Wish: populate collections from arrays/containers #76

the-Arioch opened this issue Aug 24, 2016 · 1 comment

Comments

@the-Arioch
Copy link

the-Arioch commented Aug 24, 2016

Please, implement TOmniBlockingCollection.FromArray<T>(Const Ts: TArray<T>) constructor, as described in part 2 of #55

Usage example - multi-threading files downloader via Pipeline pattern, the URLs are provided as TMemo lines.

Parrallel.Pipeline( [actions], TOmniBlockingCollection.FromArray( Memo1.Lines.ToArray() ) ).Start;

Good simple addition would be an overloaded one to support TOmniBlockingCollection.FromArray<T>(Const Ts: TEnumerable<T> ) using System.Generics.Collections.TEnumerable<T>.ToArray method.

@the-Arioch
Copy link
Author

the-Arioch commented Aug 24, 2016

Even Embarcadero understands how handy is avoding unneeded tedious for-loops by providing TList<T> with

procedure AddRange(const Values: array of T); overload;
procedure AddRange(const Collection: IEnumerable<T>); overload; inline;
procedure AddRange(const Collection: TEnumerable<T>); overload; inline;

and also providing TStringList with

procedure AddStrings(Strings: TStrings); overload; virtual;
procedure AddStrings(const Strings: TArray<string>); overload;
procedure AddStrings(const Strings: TArray<string>; const Objects: TArray<TObject>); overload;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant