namespace ExtensionMethods { public static class MyExtensions { public static void Next(this ref MyEnum item) { int count = Enum.GetNames(typeof(MyEnum)).Length; int index = item.GetHashCode(); int nextIndex = index + 1; if (nextIndex >= count) nextIndex = 0; item = (MyEnum) nextIndex; } public static void Previous(this ref MyEnum item) { int count = Enum.GetNames(typeof(MyEnum)).Length; int index = item.GetHashCode(); int prevIndex = index - 1; if (prevIndex <= 0) prevIndex = count - 1; item = (MyEnum) prevIndex; } } }