If I created the Linq statement as shown below, it works fine.
var Jobs = from a in ctx.MyExport
select new
{
FileName = a.FilePath,
JobId = a.ID,
};
If I want to use a class rather than an anonymous type, I get the following error: "It is not possible to convert a lambda expression to type" string "because it is not a delegate type."
Here is the code I want to work:
var Jobs = from a in ctx.MyExport
select new MyClass
{
FileName = a.FilePath,
JobId = a.ID,
};
And here is the class:
public class MyClass
{
public string FileName { get; set; }
public Guid JobId { get; set; }
}
Can someone tell me what I'm doing wrong and how to fix it?
source
share