mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 19:08:33 +08:00
19 lines
471 B
C#
19 lines
471 B
C#
using System;
|
|
|
|
namespace BetterLyrics.WinUI3.Extensions
|
|
{
|
|
public static class EnumExtensions
|
|
{
|
|
extension<T>(T value) where T : struct, Enum
|
|
{
|
|
public T GetNext()
|
|
{
|
|
T[] values = Enum.GetValues<T>();
|
|
int currentIndex = Array.IndexOf(values, value);
|
|
int nextIndex = (currentIndex + 1) % values.Length;
|
|
return values[nextIndex];
|
|
}
|
|
}
|
|
}
|
|
}
|