Linqtosql remove from list

myRule.ToList (). RemoveRange (0, count);

Even if it doesn't give me an error, it doesn't work. What's different?

-1


source to share


2 answers


This is because myRule.ToList () has no effect on the referenced myRule.

If myRule gets written, this should work:



myRule = myRule.ToList().RemoveRange(0, count);

      

Of course, if it's read-only, it won't work at all ... just trying to find a way around this for you ...

+1


source


You may be looking for

myRule.Skip(count);

      



or you can search

myDataContext.Customers.DeleteAllOnSubmit(myRule.Take(count));

      

0


source







All Articles