C# 无法将类型“System.Collections.Generic.IEnumerable”隐式转换为System.Collections.Generic.IEnumerable

C# 无法将类型“System.Collections.Generic.IEnumerable”隐式转换为System.Collections.Generic.IEnumerable,c#,asp.net,C#,Asp.net,我有一处房产 public IEnumerable<producto> p_producto { get { return ((from ii in contexto.productos orderby ii.nombre ascending select new producto { productoID = ii.produ

我有一处房产

public IEnumerable<producto> p_producto { 
    get { 
        return ((from ii in contexto.productos
                 orderby ii.nombre ascending
                 select new producto {
                               productoID = ii.productoId, 
                               nombre = ii.nombre,
                               descripcion = ii.descripcion, 
                               categoria = ii.categoria,
                               precio = ii.precio}));
        }
}
在Default.aspx中

public IEnumerable<producto> filtroCategoria()
{
    IEnumerable<producto> productos = repositorio.p_producto; <---- Error why ?

}
总结

无法隐式转换类型 'System.Collections.Generic.IEnumerable' 至“System.Collections.Generic.IEnumerable”。 存在显式转换。是否缺少强制转换


您有两个名为producto的类。其中一个位于TiendalExported命名空间中,另一个位于TiendalExported.Modelos中。您的存储库返回第一个的IEnumerable,而您的属性inDefault.aspx返回第二个的IEnumerable。它不能工作


请更改Default.aspx中的属性以返回IEnumerable,或者进行额外的Select调用以将TiendalExported.Modelos.producto映射到TiendalExported.producto。

非常感谢我的朋友。来自墨西哥的问候