delphi - Convert strings in ListBox to List<String> -
tlistbox component contains set of rows (strings). how can set list tlist ? code examples below, not give desired result. (Сode not compile)
mylist := tlist<string>.create(mylistbox); mylist := tlist<string>.create(mylistbox.items); mylist := tlist<string>.create(mylistbox.items.tostringarray);
is possible without using loop or not? thanks!
you can this:
mylist := tlist<string>.create; try mylist.addrange(mylistbox.items.tostringarray); .... mylist.free; end;
if wanted assign items in constructor you'd need instance of tenumerable<string>
. that's not easy graft on tstrings
outside. think above code cleanest.
Comments
Post a Comment