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:
commit
c904ae485a
@ -196,7 +196,7 @@ namespace osu.Game.Overlays
|
||||
if (!instant)
|
||||
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)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
int requested = e.Key - Key.Number1;
|
||||
|
||||
RulesetInfo found = Rulesets.AvailableRulesets.Skip(requested).FirstOrDefault();
|
||||
RulesetInfo found = Rulesets.AvailableRulesets.ElementAtOrDefault(requested);
|
||||
if (found != null)
|
||||
Current.Value = found;
|
||||
return true;
|
||||
|
@ -154,7 +154,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user