And difference between FirstOrDefault(func) & Where(func).FirstOrDefault()?

后端 未结 1 984
春和景丽
春和景丽 2020-12-21 14:05

Is there any difference between

 DataFeedManager.LoadAllDataFeeds().FirstOrDefault(d => d.ItemID == itemId);

and

DataF         


        
1条回答
  •  旧巷少年郎
    2020-12-21 14:13

    Prefer the first for brevity if you're comfortable with it.

    Prefer the second for clarity if you're not as familiar with the various overloads available.

    (Where "you" is really "everyone working on the code" of course.)

    0 讨论(0)
提交回复
热议问题