Given the following two interface classes what would the proper way to set up the two actual classes?
public interface IPortfolio { string FirstName { get; set; } string LastName { get; set; } string Name { get; set; } int Id { get; set; } List<IDocument> Documents { get; set; } } public interface IDocument { string ExtensionType { get; set; } int Id { get; set; } DateTime? DateFiled { get; set; } int? Size { get; set; } int? SortOrder { get; set; } }
The actual classes:
public class Portfolio : IPortfolio { public Portfolio() { Documents = new List<IDocument>(); } public string FirstName { get; set; } public string LastName { get; set; } public string Name { get; set; } public int Id { get; set; } public List<IDocument> Documents { get; set; } } public class Document : IDocument { public Document() { Pages = new List<IPage>(); } public string ExtensionType { get; set; } public int Id { get; set; } public DateTime? DateFiled { get; set; } public int? Size { get; set; } public List<IPage> Pages { get; set; } public int? SortOrder { get; set; } }
When using the code above I get an error about not being able to implicitly convert List<Document> to List<IDocument>
This is a learning project to understand the concept of Interfaces and how they should best be used.