Type or namespace name could not be found
Posted
by Pandiya Chendur
on Stack Overflow
See other posts from Stack Overflow
or by Pandiya Chendur
Published on 2010-04-29T13:40:25Z
Indexed on
2010/04/29
13:47 UTC
Read the original article
Hit count: 264
c#
|iqueryable
I use this:
public IQueryable<MaterialsView> FindAllMaterials()
{
var materials = from m in db.Materials
join Mt in db.MeasurementTypes on m.MeasurementTypeId
equals Mt.Id
select new MaterialsView {
MatId = m.Mat_Name,
MesName = Mt.Name,
MesType = m.Mat_Type };
return materials;
}
It gives me the following errors:
The type or namespace name
MaterialsView
could not be found (are you missing a using directive or an assembly reference?)Cannot implicitly convert type
System.Collections.Generic.IEnumerable<MaterialsView>
toSystem.Linq.IQueryable<MaterialsView>
. An explicit conversion exists (are you missing a cast?)The type arguments for method
System.Linq.Enumerable.ToList<TSource>(System.Collections.Generic.IEnumerable<TSource>)
cannot be inferred from the usage. Try specifying the type arguments explicitly.
I have googled it and found this SO question but it doesn't help.
What's wrong?
© Stack Overflow or respective owner