🚚 Rename StructExtensions to EnumExtensions

This commit is contained in:
Oliver Booth 2021-01-16 15:06:48 +00:00
parent 0512d7d568
commit 6f26c04f6c
1 changed files with 5 additions and 5 deletions

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)
{ {