How can I do multiple operations inside a C# LINQ ForEach loop
I have a list of Question objects and I use a ForEach to iterate through
the list. For each object I do an .Add to add it into my entity framework
and then the database.
List<Question> add = problem.Questions.ToList();
add.ForEach(_obj => _uow.Questions.Add(_obj));
I need to modify each of the objects in the ForEach and set the
AssignedDate field to DateTime.Now Is there a way I can do this inside of
the ForEach loop?
No comments:
Post a Comment