下面的代码中 Succeed(article)
的地方会报错
public async Task<BooleanResult<(int ArticleId, string Title)>> Exists(int brandId, int sourceArticleId)
{
var article = await _articleRepository
.Query(a => a.BrandId == brandId && a.SourceArticleId == sourceArticleId)
.Select(a => Tuple.Create(a.Id, a.Title))
.FirstOrDefaultAsync();
return BooleanResult<(int ArticleId, string Title)>.Succeed(article);
}
报错信息
Argument 1: cannot convert from 'System.Tuple<int, string>' to '(int ArticleId, string Title)'
请问如何解决?
ToValueTuple 可以解决
return BooleanResult<(int ArticleId, string Title)>.Succeed(article.ToValueTuple());