mpora
mpora

Reputation: 1479

set an entity collection to empty in c#

How do you set an entity collection to null? I have tried something like this

user.movies = new List<movie>();

but I am getting this error:

Cannot implicitly convert type 'System.Collections.Generic.List<MvcApplication2.dal.movie>' to 'System.Data.Objects.DataClasses.EntityCollection<MvcApplication2.dal.movie>'

Upvotes: 0

Views: 1606

Answers (1)

Srikant Krishna
Srikant Krishna

Reputation: 881

user.movies.Clear(); or user.movies = null;

Upvotes: 5

Related Questions