I have a huge data table which I want to filter. However the filter activity is too slow. Do you know any other way I can filter based on a column? For example I want to filter for anything that has 23 at the end or before a “?” In column 2. Example below.
assign activity
left side: Datatable | dtFiltered
right side:
(From d in yourDataTableVar.AsEnumerable
Where d(YourColNameOrIndex).tostring.trim().EndsWith(“23”) Or d(YourColNameOrIndex).tostring.trim().Contains(“?”)
Select d).CopytoDataTable
the check for ? can may be better expresed with a Regex
So an alternate could look like:
(From d in yourDataTableVar.AsEnumerable
Where Regex.IsMatch(d(YourColNameOrIndex).tostring.trim(),"\?\d{2}$|23$")
Select d).CopytoDataTable