how to create more accurate searching c#
var keywords = new [] {"Sergey", "Berezovskiy"};
var users = from u in context.Users
let match = (keywords.Contains(u.FirstName) ? 1 : 0) +
(keywords.Contains(u.LastName) ? 1 : 0) +
(keywords.Contains(u.MiddleName) ? 1 : 0)
where match > 0
orderby match descending,
u.LastName, u.FirstName
select u;
var methodChain = context.Users
.Select(u => new
{
u,
match = (keywords.Contains(u.FirstName) ? 1 : 0) +
(keywords.Contains(u.LastName) ? 1 : 0) +
(keywords.Contains(u.MiddleName) ? 1 : 0)
})
.Where(t => t.match > 0)
.OrderByDescending(t => t.match)
.ThenBy(t.u.LastName)
.ThenBy(t.u.FirstName)
.Select(t => t.p);
Also in C#:
- Title
- what does gameobject.find return
- Category
- C#
- Title
- javascript append
- Category
- C#
- Title
- c# shorten an method
- Category
- C#
- Title
- iterate through dictionary c#
- Category
- C#
- Title
- jumping with character controller unity
- Category
- C#
- Title
- c# making a folder wpf
- Category
- C#
- Title
- reload scene unity
- Category
- C#
- Title
- visual studio C# hintergrund bild ändern
- Category
- C#
- Title
- unity check tag
- Category
- C#
- Title
- asp.net mvc return file
- Category
- C#
- Title
- how to declare variables in c#
- Category
- C#
- Title
- divide string in chunks c#
- Category
- C#
- Title
- how to find the area of a circle
- Category
- C#
- Title
- linq c# where condition
- Category
- C#
- Title
- string format c#
- Category
- C#
- Title
- c# shorten an definition
- Category
- C#
- Title
- input get button uibutton
- Category
- C#
- Title
- unity how to end a game with esc
- Category
- C#
- Title
- unity get max occurrence in list
- Category
- C#
- Title
- xamarin forms alarm
- Category
- C#
- Title
- convert string to int c#
- Category
- C#
- Title
- bytes size c#
- Category
- C#
- Title
- F# convert generic.List to list
- Category
- C#
- Title
- unity image
- Category
- C#