1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 01:47:24 +08:00

Make use of ElementAtOrDefault() when possible (#7695)

Make use of ElementAtOrDefault() when possible
This commit is contained in:
Dean Herbert 2020-02-01 11:05:00 +09:00 committed by GitHub
commit c904ae485a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -196,7 +196,7 @@ namespace osu.Game.Overlays
if (!instant) if (!instant)
queuedDirection = TrackChangeDirection.Next; queuedDirection = TrackChangeDirection.Next;
var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).Skip(1).FirstOrDefault() ?? BeatmapSets.FirstOrDefault(); var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();
if (playable != null) if (playable != null)
{ {

View File

@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
int requested = e.Key - Key.Number1; int requested = e.Key - Key.Number1;
RulesetInfo found = Rulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); RulesetInfo found = Rulesets.AvailableRulesets.ElementAtOrDefault(requested);
if (found != null) if (found != null)
Current.Value = found; Current.Value = found;
return true; return true;

View File

@ -154,7 +154,7 @@ namespace osu.Game.Rulesets.Edit
{ {
if (e.Key >= Key.Number1 && e.Key <= Key.Number9) if (e.Key >= Key.Number1 && e.Key <= Key.Number9)
{ {
var item = toolboxCollection.Items.Skip(e.Key - Key.Number1).FirstOrDefault(); var item = toolboxCollection.Items.ElementAtOrDefault(e.Key - Key.Number1);
if (item != null) if (item != null)
{ {