I have list of strings like:
AB1DF|Mango
A2kdF|Strawberry2
IDLWI22|GRAPE
SI|lemon1
LIN|watermelon
SKI|lemon2
BDW04|Strawberry1
Each string is made of 2 substrings separated by pipeline (|)
For a given input string, I have to create sublist where the substring from '|' is like the given input string,
and I am doing this as:
IEnumerable<string> result = JobsList.Where(
delegate(string s) { return s.Substring(s.LastIndexOf("|")).ToLower().Contains(strInput.ToLower());});
and the above works good.
Now I want the above result list be in the order of substrings after the pipeline character.
For example, if the input string is 'strawberry' the result should be:
BDW04|Strawberry1
A2kdF|Strawberry2
and not in the reverse order
How do I add OrderBy clause to the above linq to order by substring following the '|' character?
AB1DF|Mango
A2kdF|Strawberry2
IDLWI22|GRAPE
SI|lemon1
LIN|watermelon
SKI|lemon2
BDW04|Strawberry1
Each string is made of 2 substrings separated by pipeline (|)
For a given input string, I have to create sublist where the substring from '|' is like the given input string,
and I am doing this as:
IEnumerable<string> result = JobsList.Where(
delegate(string s) { return s.Substring(s.LastIndexOf("|")).ToLower().Contains(strInput.ToLower());});
and the above works good.
Now I want the above result list be in the order of substrings after the pipeline character.
For example, if the input string is 'strawberry' the result should be:
BDW04|Strawberry1
A2kdF|Strawberry2
and not in the reverse order
How do I add OrderBy clause to the above linq to order by substring following the '|' character?
Thanks,
-srinivas y.
sri