score:0
You could achieve your goal by using regular expressions. See Regex.Match Method. You can transform your selected string from the dropdown list into a regular expression then use the Match method in your LINQ query.
Regex r = new Regex(String.Format ("Customer {0} has {1} orders", "([^\s]+)", "([^\s]+)"));
This code:
o.CustomField.Contains(searchString)
can then be changed to:
r.Match(o.CustomField).Success
score:0
Just do a Regex.Replace
on {\d+}
, replacing it with *
.
Something like:
string s = Regex.Replace(input, @"{\d+}", "*");
score:0
Try the approach mentioned here
Or use combination of field.StartsWith("Customers") && field.EndsWith("orders") && field.Contains("has")
Source: stackoverflow.com
Related Articles
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- LINQ Source Code Available
- .NET 4 Code Contracts: "requires unproven: source != null"
- Linq equivalent for collection contains at least x items; like .Any() but instead .AtLeast(int)
- How to render this map-reduce javascript code to an equivalent LINQ Select-Aggregate?
- SQL LIKE Equivalent in C#
- Linq equivalent to SQL LIKE [a-f]
- What is the SQL LIKE operator equivalent in LINQ having multiple % operators in the input text?
- creating Linq to sqlite dbml from DbLinq source code
- what is equivalent c# code for following statement?
- linq to dataset equivalent of SQL LIKE clause
- Linq union all equivalent of sql code
- C# code for equivalent LINQ query
- how to write LINQ to objects equivalent code for this code
- source code for LINQ 101 samples
- Linq extension method equivalent for that code in VB.NET
- Equivalent sql code insert/sql in entity framework in code-first
- I would like others to explain this piece of code to me
- List or Array of String Contain specific word in Html Source Code
- new to linq. compiler doesnt like my query. Code provided
- Equivalent C# LINQ code for SQL
- I have some code that I would like to turn to linq
- Like Operator equivalent in LINQ
- LINQ equivalent of SQL LIKE for text field with digits
- What is the equivalent argument matcher for a parameter like this - "Expression<Func<TEntity, bool>> predicate)" in NSubsitute?
- c# Linq or code to extract groups from a single list of source data
- What is the Java equivalent for LINQ?
- LINQ equivalent of foreach for IEnumerable<T>
- How to do SQL Like % in Linq?
- Convert string[] to int[] in one line of code using LINQ
- Using LINQ with tree structures
- LINQ to SQL LoadWith Mutilple Joins
- Using linq to extract titles from sitemap files
- Returning multiple records using first/earliest date
- Get the next enumerated item after applying a predicate via Linq
- Query to select worst-selling products
- Distinct not comparable error when binding LINQ query to asp:DataList
- How to distinct for a list of list using LINQ?
- Object grouping with linq or lambda expression
- LINQ query using Contains and conditional logic
- LINQ/C# - Making a DTO from a collection?
- order datatable by relevance using linq by column values which are comma sperated
- Variable Includes in Linq to Sql EF statement
- How to delete and re-insert entities in linq?
- Get selected element by combobox from XML file
- Why does Visual Studio think my "yield return" method returns a dynamic object?
- Why can I not delete an entity with just .DeleteObject(o)?
- dictionary of lists in c#(cant seem to get my lists)
- XML to LINQ in ViewModel to populate Model
- Two lists - get common fields?