Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
You could use something like: commentList= commentList.Where(x => x.UserEmail!=pageComment.UserEmail).ToList();
or
"commentList.RemoveAll(x => x.UserEmail == pageComment.UserEmail);" instead of "commentList = commentList.RemoveAll(x => x.UserEmail == pageComment.UserEmail);"
the int in the error is the number of elements removed from the list
This might not be a typical EPiServer question but i'm trying to remove items from a list using Linq but fails.
I have a Comment class with a string property called UserEmail
When someone adds a new comment and it's saved to DDS i send a email to those how has already commented on the same article but i don't want the person making the comment recive a mail. Like this:
List<PageComment> commentList;
commentList = GetComments(pageRef);
commentList = commentList.RemoveAll(x => x.UserEmail == pageComment.UserEmail);
The Linq expression gives this error:
Cannot implicitly convert type 'int' to 'System.Collections.Generic.List<PageComment>'
Why int? I'm dealing with strings here??
/David