Hello,
I have two TreeNodeDatasets A an B. They may have some common TreeNodes, but may not.
I wish to exclude elements of B which are found in A, from set A.
Code:
var pinnedArticles = TreeHelper.GetDocuments(CMSContext.CurrentSiteName, "/Articles/Pinned-Articles/%",
CMSContext.PreferredCultureCode, false, "custom.article", null,
null, 1, true, 5);
var taggedArticles = TreeHelper.GetDocuments(CMSContext.CurrentSiteName, "/Articles/%",
CMSContext.PreferredCultureCode, false, "custom.article",
whereCondition, null, 5, true, 5);
if (pinnedArticles != null)
{
foreach (var article in pinnedArticles)
{
article.NodeCustomData.Value = "isPinned";
if (taggedArticles.Any(m => m.DocumentGUID == article.DocumentGUID))
{
var articleToRemove = taggedArticles.First(m => m.DocumentGUID == article.DocumentGUID);
taggedArticles.Items.Remove(articleToRemove);
}
}
I get a NullReferenceException on the highlighted line. Inspecting the code, however, shows that "articleToRemove" is not null.
Any assistance would be appreciated.