vendredi 12 mai 2017

Return object and List

I have two classes

public class LoginModel : IBaseInterface
{
   public string EmailAddress { get; set; }
   public string Password { get; set; }
}

and

public class UsersModel : IBaseInterface
{
    public int UserID { get; set; }
    public string UserName { get; set; }
    public string EmailAddress { get; set; }
    public int RoleID { get; set; }
    public string RoleName { get; set; }
    public int ProjectID { get; set; }
    public string ProjectName { get; set; }
    public int PMID { get; set; }
    public string PMEmailAddress { get; set; }
    public string PMEmailName { get; set; }
    public int DMID { get; set; }
    public string DMEmailAddress { get; set; }
    public string DMEmailName { get; set; }
}

IBaseInterface is an intergace and has nothing in definition.

public static IBaseInterface Create(ObjectsCollection Type)
    {
        switch (Type)
        {
            default:
                return null;
            case ObjectsCollection.UsersModel:
                return new UsersModel();
            case ObjectsCollection.LoginModel:
                return new LoginModel();
        }
    }

Everything was working fine for objects. But how to return a List<UsersModel> and List<LoginModel> using this Factory?

Would be nice if someone please help me to resolve this issue.

Thanks

Aucun commentaire:

Enregistrer un commentaire