- Yes, the SQL query you used to retrieve the data includes an
ORDER BY WidgetID
clause. This means that the data read by theSqlDataReader
(rdr
) will be sorted byWidgetID
, and as you populate theWidgets
list in the order read from the reader, the list will remain sorted byWidgetID
. - Using the
Where
method (notWhile
as in your example) to filterWidgets
will maintain the order of the original list.
Dim SomeWidgets = Widgets.Where(Function(wdgt) wdgt.Color = Blue).ToList()
Best Regards.
Jiachen Li
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.