我有几个接口(interface),IOrganisations 和 IPeople。
如果我想返回与组织关联的人员列表,我应该在哪个界面中创建它?
结果基于组织,但我返回的是人的列表
最佳答案
在 IOrganisation
上执行(并将 IPeople
作为返回类型)。
像这样:
interface IOrganisation {
IList<IPeople> GetPeople();
}
这是因为组织的人员是组织的属性(property),而不是人员的属性(property)。
关于C# 接口(interface)返回类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7674950/