c# - .NET BindingSource.Filter with regular expressions -
I am using BindingSource.Filter for a list of certain elements of the data source. Especially I love this:
m_bindingSourceTAnimation.Filter = "like name" "+ FilterText +"; ''; Now my question is, if it is possible to use regular expressions with these filters.
I would especially need many wildcards (*) characters such as
* Hello * World * Thanks!
You can very easily query the DataTable with LINQ and then you really like it You can use the actual Regex within the query for.
Something like this ...
var source = myDataTable.AsEnumerable (); Var result = matchingItem in the source where choose Regex.IsMatch (matchItem.Field & lt; string & gt; ("name"), "& lt; put regex here & gt;") matchingItem; // If you want them as a list, then for you (to pair or do something) var list = to.ToList (); This will get you the rows based on a real reggae, I do not know what you need to do with the information, but it will allow you to get rows based on it. A Reggae
**** UPDATE ** - Trying to clarify on the basis of the comment
I do not know why you are using it, so I have a great reference, But from what I can guess, you are using datatable to bind data from grid or something like that. If this is the case, then I think that you should be able to assign a "list" to the snippet that I put here (assuming you are using a binding source) and I think it will work. I do not use data tabs, I usually paste objects with objects to work with them, so I'm not sure how to handle this list of rows, but I It would seem that this will work, it will be done).
Comments
Post a Comment