Say I have the following interface:
public interface IUserListVM { IList<string> UserList { get; } }
and a view model that implements the interface of this model:
public class UserListVM : IUserListVM { private IList<string> userList = new List<string>(); IList<string> UserList { get { return userList; } } }
then it is possible to have a view that expects a model that inherits IUserListVM. Let's say that I have a partial UserList view that looks something like this:
@model MVCWebsite.Views.IUserListVM @foreach (string user in Model.UserList) { user }
The point of this is to have partial representations as autonomous as possible.
source share