I am trying to compare two strings containing IDs with Razor, but I can't figure out how to do the compare correctly.
I have two list.
List 1 which is a string placed in a cookie, containing all pages from the user's last visit.
List 2 which is a string of all pages from the user's current visit.
What I want is to do a compare of these two strings to see if there is a page ID in List 2, which isn't in List 1. Then that page will be a new page since the last vist.
I have this code.
var pageList = Request.Cookies["pageCookie"].Value;
var allPages = siteroot.Descendants("Event");
var idList = "";
foreach (var node in allPages.Where("Visible"))
{
idList += node.Id+",";
}
The two lists looks like:
List1: 1525,1585,1595,1600,1605,1610,1885
List2: 1525,1585,1595,1600,1605,1610,1885,1900
Then I would like to check these two strings to see if there is an ID in List 2 which isn't in List 1 like:
if((id in list 2 not in list 1)) {
output section
}
That would find that ID 1900 is not in List 1.