c# - Linq remove all -
im trying replace items in list removeall function, didnt realize removes index of list. there function can replace objects instead of remove them? comparing strings.
items.removeall(x => commonitems.any(y => y.itemname == x.itemname));
or maybe 1 time removed replace empty index @ same spot?
you replace removeall
where
records want modify first:
var matches = items.where(x => commonitems.any(y => y.itemname == x.itemname));
then iterate through results , replace value:
foreach (var match in matches) match.itemname = "n/a";
c# linq
No comments:
Post a Comment