为什么没有这个工作,以及如何解决?接口和铸造列表
public interface ITheInterface
{
string a{get;set;}
string b{get;set;}
}
public class SomeObject: ITheInterface
{
string a{get;set;}
string b{get;set;}
...
}
public class SomeGroup
{
ITheInterface Result;
...
}
var results= from y in dc.Groups
where y.id==1
select new SomeGroup
{
Result= (from x in dc.Objects
select new SomeObject{... }
).SingleOrDefault(),
}
return results.ToList();
无法从System.Collections.Generic.List
类型转换为界面
为什么没有工作?你遇到了什么错误? – 2009-06-02 00:34:01
请给出一个简短的*完整的*程序,否则我们不能告诉发生了什么问题。 – 2009-06-02 05:32:31