p.Id)"和 "orderby p.Id ascending"之间的区别-6ren"> p.Id)"和 "orderby p.Id ascending"之间的区别-这个问题已经有答案了: 已关闭12 年前。 Possible Duplicates: Which LINQ syntax do you prefer? Fluent or Query Expressi-6ren">
gpt4 book ai didi

linq - ".OrderBy(p => p.Id)"和 "orderby p.Id ascending"之间的区别

转载 作者:行者123 更新时间:2023-12-02 08:54:25 27 4
gpt4 key购买 nike

Possible Duplicates:
Which LINQ syntax do you prefer? Fluent or Query Expression
LINQ: Dot Notation vs Query Expression

Linq 中的两种排序方法有什么区别?一个比另一个性能更好吗?

最佳答案

查询语法是转换为方法方法的语法糖。没有区别,使用适合您需要的任何样式。

来自LINQ Query Syntax versus Method Syntax MSDN 文章:

there is no semantic difference between method syntax and query syntax. In addition, some queries, such as those that retrieve the number of elements that match a specified condition, or that retrieve the element that has the maximum value in a source sequence, can only be expressed as method calls.

关于linq - ".OrderBy(p => p.Id)"和 "orderby p.Id ascending"之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6127225/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com