您的位置:首页 > 产品设计 > UI/UE

Item 8: Prefer Query Syntax to Loops(Effective C#)

2011-01-15 10:36 501 查看
  C# began as an imperative language. It continues to include all the features that are part of that heritage. It’s natural to reach for the most familiar tools at your disposal. However, those tools might not be the best tools. When you find yourself writing any form of a looping construct, ask yourself if you can write that code as a query. If the query syntax does not work, consider using the method call syntax instead. In almost all cases, you’ll find that you create cleaner code than you would using imperative looping constructs.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: