1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:18:47 +00:00

🚚 Rename StructExtensions to EnumExtensions

This commit is contained in:
Oliver Booth 2021-01-16 15:06:48 +00:00
parent 0512d7d568
commit 6f26c04f6c

View File

@ -3,9 +3,9 @@
namespace X10D namespace X10D
{ {
/// <summary> /// <summary>
/// Extension methods for <see langword="struct" /> types. /// Extension methods for <see langword="enum" /> types.
/// </summary> /// </summary>
public static class StructExtensions public static class EnumExtensions
{ {
/// <summary> /// <summary>
/// Returns the next value in an <see cref="Enum" /> using the specified value as a starting point. /// Returns the next value in an <see cref="Enum" /> using the specified value as a starting point.
@ -18,11 +18,11 @@ namespace X10D
/// </param> /// </param>
/// <returns>Returns a <see cref="T" /> value.</returns> /// <returns>Returns a <see cref="T" /> value.</returns>
public static T Next<T>(this T src, bool wrap = true) public static T Next<T>(this T src, bool wrap = true)
where T : struct where T : struct, Enum
{ {
if (!typeof(T).IsEnum) if (!typeof(T).IsEnum)
{ {
throw new ArgumentException($"Argument {typeof(T).FullName} is not an Enum"); throw new ArgumentException($"Argument {typeof(T).FullName} is not an enum");
} }
var arr = (T[])Enum.GetValues(src.GetType()); var arr = (T[])Enum.GetValues(src.GetType());
@ -41,7 +41,7 @@ namespace X10D
/// </param> /// </param>
/// <returns>Returns a <see cref="T" /> value.</returns> /// <returns>Returns a <see cref="T" /> value.</returns>
public static T Previous<T>(this T src, bool wrap = true) public static T Previous<T>(this T src, bool wrap = true)
where T : struct where T : struct, Enum
{ {
if (!typeof(T).IsEnum) if (!typeof(T).IsEnum)
{ {