[英]Equivalent of SQL Query with linq
I search an equivalent with LINQ for this query : 我使用LINQ搜索等效的查询:
SELECT *
FROM Shapes
ORDER BY ABS(45.403703 - Latitude), ABS(- 71.948638 - Longitude)
Someone have an idea? 有人有想法吗? I begin with linq
我从linq开始
Something like this? 像这样的东西?
var result = shapes
.OrderBy(s => Math.Abs(45.403703 - s.Latitude))
.ThenBy(s => Math.Abs(-71.948638 - s.Longitude));
var results =
from x in shapes
orderby Math.Abs(45.403703 - x.Latitude),
Math.Abs(- 71.948638 - x.Longitude)
select x;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.