C# update object in list

Viewed 11348

I have a repository with a public List<someView> list; Is it not possible to get an item with linq like this and just update/replace the whole object so the object in the list is updated globally right away?

...
var item = list.SingleOrDefault(m => m.Id== viewModel.Id);
if (item != null)
{
    item = viewModel;
}
...
1 Answers
Related