Sort List by occurrence of a word by LINQ C#
Posted
by
Thomas
on Stack Overflow
See other posts from Stack Overflow
or by Thomas
Published on 2012-07-09T09:07:21Z
Indexed on
2012/07/09
9:15 UTC
Read the original article
Hit count: 223
i have stored data in list like
List<SearchResult> list = new List<SearchResult>();
SearchResult sr = new SearchResult();
sr.Description = "sample description";
list.Add(sr);
suppose my data is stored in description field like
"JCB Excavator - ECU P/N: 728/35700"
"Geo Prism 1995 - ABS #16213899"
"Geo Prism 1995 - ABS #16213899"
"Geo Prism 1995 - ABS #16213899"
"Wie man BBA reman erreicht"
"this test JCB"
"Ersatz Airbags, Gurtstrammer und Auto Körper Teile"
now i want to query the list with my search term like geo jcb
if you look then the word geo has stored many times in the description field. so i want to sort my list in such way that the word in search term found maximum that data will come first. please help me to do so. thanks
© Stack Overflow or respective owner