mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 18:18:48 +00:00
📚 Add XML doc to StructExtensions
This commit is contained in:
parent
d1d89de250
commit
bb2dedccad
@ -7,10 +7,18 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of extension methods for <see langword="struct"/> types.
|
/// Extension methods for <see langword="struct"/> types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class StructExtensions
|
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
|
public static T Next<T>(this T src, bool wrap = true) where T : struct
|
||||||
{
|
{
|
||||||
if (!typeof(T).IsEnum)
|
if (!typeof(T).IsEnum)
|
||||||
@ -23,6 +31,14 @@
|
|||||||
return arr.Length == j ? arr[wrap ? 0 : j - 1] : arr[j];
|
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
|
public static T Previous<T>(this T src, bool wrap = true) where T : struct
|
||||||
{
|
{
|
||||||
if (!typeof(T).IsEnum)
|
if (!typeof(T).IsEnum)
|
||||||
|
Loading…
Reference in New Issue
Block a user