S
shapper
Hello,
I am mapping a class Error to another class YError:
YError ToY(Error error) {
return new YError {
Id = error.ErrorId,
CreatedAt = error.CreatedAt,
Description = error.Description,
HttpCode = error.HttpCode,
};
} // ToY
Now I am trying a new version that does the mapping for many errors:
IQueryable<YError> ToY(IQueryable<Error> error) {
return error.Select(e => e = <YError>ToY(error)).AsQueryable();
} // ToY
But I get the error:
Cannot implicitly convert type
'System.Linq.IQueryable<MyApp.Models.YError>' to 'MyApp.Models.Error'.
An explicit conversion exists (are you missing a cast?)
What am I missing?
Thanks,
Miguel
I am mapping a class Error to another class YError:
YError ToY(Error error) {
return new YError {
Id = error.ErrorId,
CreatedAt = error.CreatedAt,
Description = error.Description,
HttpCode = error.HttpCode,
};
} // ToY
Now I am trying a new version that does the mapping for many errors:
IQueryable<YError> ToY(IQueryable<Error> error) {
return error.Select(e => e = <YError>ToY(error)).AsQueryable();
} // ToY
But I get the error:
Cannot implicitly convert type
'System.Linq.IQueryable<MyApp.Models.YError>' to 'MyApp.Models.Error'.
An explicit conversion exists (are you missing a cast?)
What am I missing?
Thanks,
Miguel