If I created a 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 "Cannot convert 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 anyone tell me what I am doing wrong and how to fix it?