c# - Clear list but retain Session -
i have code list shown,
var refinedclaimsearchnew = new claimsearch(); (int = 1; < refinedictionary.length; i++) { list<claimsearchdatavalues> claimtable = new list<claimsearchdatavalues>(); int count = i; if (count == 1) { claimtable = refinedclaimsearch.rowvalues; } else { //my problem in else loop claimtable = (list<claimsearchdatavalues>)session["test"];//get list out of session if (refinedclaimsearchnew.rowvalues != null) { refinedclaimsearchnew.rowvalues.clear(); //and clear list retain session value} } var dictionaryitems = refinedictionary[i]; string[] dictionaryitemssplit = dictionaryitems.split(','); (int j = 1; j < dictionaryitemssplit.length; j++) { var nodeelement = dictionaryitemssplit[j]; foreach (var row in claimtable) { var currentrow = row; bool hasrefinevalue = false; foreach (var rowvalues in currentrow.cellvalues) { if (rowvalues.key == nodeelement || rowvalues.value == nodeelement) { hasrefinevalue = true; } } if (hasrefinevalue == true) { refinedclaimsearchnew.rowvalues.add(currentrow); } } } session["test"] = refinedclaimsearchnew.rowvalues;//storing list in session }
i'm storing list in session , next iteration want remove stored list session @ same time clear list can use new list again.. looks when take list out of session-its fine, next line when clear() list, list retrieved session becomes 0.. please me know how that....
Comments
Post a Comment