NHibernate: use of IEnumerable as collection type results in error
问题 I have a class which uses an ISet as a collection type as below: public class Client { private ISet<Contact> _contacts = new HashedSet<Contact>(); public virtual ISet<Contact> Contacts { get { return _contacts; } } } I don't want the collection itself to be able to be modified externally. However, if I change the property's type to IEnumerable as below: public class Client { private ISet<Contact> _contacts = new HashedSet<Contact>(); public virtual IEnumerable<Contact> Contacts { get { return