SELECT * FROM Customer WHERE Name 'LIKE [af]%'
How can I achieve this in Linq?
In other words, in linq, how can I select all the names between a and f?
Thanks,
The class System.Data.Linq.SqlClienthas a helper class called SqlMethods , which provides a method Likethat emulates the SQL LIKE statement.
System.Data.Linq.SqlClient
Like
Your request:
var query = from c in Customers where SqlMethods.Like(c.Name, "[a-f]%") select c;
You can use the C # Regex class to map entries:
var selectedCustomers = from customer in customers where Regex.Match(customer.Name, "^[a-f].*$").Success select customer;
Source: https://habr.com/ru/post/1720247/More articles:Placing a small arrow over the letter css - cssAdding Script Binding / Creating Migration - pluginsto remove char from binary - delphiRelative URLs in ActionScript 3 - flashПрограммно конвертировать DITA в FrameMaker - ditaParsing XML in (J) Ruby and pasting into a database - ruby | fooobar.comNetwork difference between two lines in javascript - javascriptTomcat and MySql on VPS - performanceNumeric string (arbitrary size) → Multiple integers - phpSpring MVC - jsp not running - javaAll Articles