I have generic list already filled with values, I need to sort items, that first value should appear same as query string. Is it possible to compare and sort this values, I'm trying with no success.
Bit updating my question.
For example I have Id: 1,2,3,4,5, and I opened page with Id=5, so I need on my searchResult, to pass 4 as first item in the list.
This code for me worked fine and showing 5 as first item, but I need to force for example p2.ObjectId pass as string value just for example "4294", and object with this Id should appear first:
Sort(searchresult);
static void Sort(List<CollectionsItem> list)
{
list.Sort((p1, p2) => string.Compare(p2.ObjectId, p1.ObjectId, true));
}