📚 Add XML doc to StructExtensions

This commit is contained in:
Oliver Booth 2019-11-16 11:15:21 +00:00
parent d1d89de250
commit bb2dedccad
No known key found for this signature in database
GPG Key ID: 4B0992B2602C3778
1 changed files with 17 additions and 1 deletions

View File

@ -7,10 +7,18 @@
#endregion
/// <summary>
/// A set of extension methods for <see langword="struct"/> types.
/// Extension methods for <see langword="struct"/> types.
/// </summary>
public static class StructExtensions
{
/// <summary>
/// Returns the next value in an <see cref="Enum"/> using the specified value as a starting point.
/// </summary>
/// <typeparam name="T">An <see cref="Enum"/>.</typeparam>
/// <param name="src">An <see cref="Enum"/> value</param>
/// <param name="wrap">Optional. Whether or not to wrap to the to the start of the enum. Defaults to
/// true.</param>
/// <returns>Returns a <see cref="T"/> value.</returns>
public static T Next<T>(this T src, bool wrap = true) where T : struct
{
if (!typeof(T).IsEnum)
@ -23,6 +31,14 @@
return arr.Length == j ? arr[wrap ? 0 : j - 1] : arr[j];
}
/// <summary>
/// Returns the previous value in an <see cref="Enum"/> using the specified value as a starting point.
/// </summary>
/// <typeparam name="T">An <see cref="Enum"/>.</typeparam>
/// <param name="src">An <see cref="Enum"/> value</param>
/// <param name="wrap">Optional. Whether or not to wrap to the to the end of the enum. Defaults to
/// true.</param>
/// <returns>Returns a <see cref="T"/> value.</returns>
public static T Previous<T>(this T src, bool wrap = true) where T : struct
{
if (!typeof(T).IsEnum)