I have a List<List<string>> and need to filter the inner List. It looks like this:
{["/DownloadFile2.aspx?File=1026704PR20131001.PDF","10/1/2013 | Monthly Memo","10/1/2013","","","CI","","","","","",""],
["/DownloadFile2.aspx?File=1026704PR20141001.PDF","10/1/2014 | Monthly Memo","10/1/2014","","","CC","","","","","",""],
["/DownloadFile2.aspx?File=1026704date20130928.PDF","9/30/2013 | New Memo","9/30/2013","","","CC","","","","","",""],
["/DownloadFile2.aspx?File=1026704date20140928.PDF","9/30/2014 | New Memo","9/30/2014","","","CI","","","","","",""]}
How would I filter the second column using a LINQ .Where clause?
Like filtering on the term "Monthly" would return:
{["/DownloadFile2.aspx?File=1026704PR20131001.PDF","10/1/2013 | Monthly Memo","10/1/2013","","","CI","","","","","",""],
["/DownloadFile2.aspx?File=1026704PR20141001.PDF","10/1/2014 | Monthly Memo","10/1/2014","","","CC","","","","","",""]}
Adding Code
Archive Definition from my web service:
[DataContract(Namespace = "http://www.mysite.com")]
public class Archive
{
[DataMember]
public List<string> Header {get; set;}
[DataMember]
public List<List<string>> Rows{get; set;}
}
Code geting the Archive from the service (mps is the web service)
/// param contains values used to retrieve a partial set
/// as well as other values used to pass data to jQuery DataTable
///
Archive docs = mps.GetArchiveArray(LogonTicket, PID, param.iDisplayStart, param.iDisplayLength, "D");
List<List<string>> filteredRows;
// If the params sSearch value is not null or empty, filter the results
// else return the full results
if (!string.IsNullOrEmpty(param.sSearch))
{
// Here's where I need to filter the result set based on the params.sSeach value.
filteredRows = docs.Rows.?????;
}
else
{
filteredRows = docs.Rows;
}
The filteredRows are then passed through a loop to build my JSON using a StringBuilder and then the full desired result is sent as JSON:
string result = sb.ToString();
return Json(new
{
sEcho = param.sEcho,
iTotalRecords = numDocs,
iTotalDisplayRecords = numDocs,
aaData = result
},
JsonRequestBehavior.AllowGet);