【发布时间】:2019-05-10 09:44:55
【问题描述】:
我有一个建议的字典项架构,如下所示:
public interface IDataDictionary
{
List<IDataDictionaryItem> DictionaryItems { get; set; }
}
而字典项为:
public interface IDataDictionaryItem
{
Guid Guild { get; set; }
int SequenceId { get; set; }
string Title { get; set; }
string Value { get; set; }
string Description { get; set; }
string Language { get; set; }
}
当我尝试在这样的具体类中实现它时:
public class HairColorDictionary : IDataDictionary
{
public List<HairColor> DictionaryItems { get; set; }
}
项目具体实现:
public class HairColor : IDataDictionaryItem
{
public Guid Guild { get; set; }
public int SequenceId { get; set; }
public string Title { get; set; }
public string Value { get; set; }
public string Description { get; set; }
public string Language { get; set; }
}
我收到以下错误消息,但我似乎无法理解它。 有人可以告诉我哪里出错了。
错误信息:
错误 CS0738“HairColorDictionary”未实现接口成员“IDataDictionary.DictionaryItems”。 “HairColorDictionary.DictionaryItems”无法实现“IDataDictionary.DictionaryItems”,因为它没有匹配的返回类型“List”。
【问题讨论】:
-
与引用的可能重复项有一定的相似性,但这无疑从不同的角度提供了对问题/解决方案的更好理解。
标签: c#