Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
X1nto committed Jan 14, 2022
1 parent a119ae3 commit 7ceb8c9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 38 deletions.
59 changes: 30 additions & 29 deletions Sharplin/Collection/Indexes.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
namespace Sharplin.Collection;

using System;
using System.Collections.Generic;

public static class Indexes
{
/// <returns><see cref="Range"/> of valid indices for the <paramref name="source"/>.</returns>
Expand All @@ -18,63 +15,67 @@ public static class Indexes
/// <inheritdoc cref="Array.FindIndex{T}(T[], Predicate{T})"/>
public static int FindIndex<TSource>(this TSource[] array, Predicate<TSource> match) =>
Array.FindIndex(array, match);

/// <inheritdoc cref="Array.FindIndex{T}(T[], int, Predicate{T})"/>
public static int FindIndex<TSource>(this TSource[] array, int startIndex, Predicate<TSource> match) =>
Array.FindIndex(array, startIndex, match);

/// <inheritdoc cref="Array.FindIndex{T}(T[], int, int, Predicate{T})"/>
public static int FindIndex<TSource>(this TSource[] array, int startIndex, int count, Predicate<TSource> match) =>
Array.FindIndex(array, startIndex, count, match);

/// <inheritdoc cref="Array.FindLastIndex{T}(T[], Predicate{T})"/>
public static int FindLastIndex<TSource>(this TSource[] array, Predicate<TSource> match) =>
Array.FindLastIndex(array, match);

/// <inheritdoc cref="Array.FindLastIndex{T}(T[], int, Predicate{T})"/>
public static int FindLastIndex<TSource>(this TSource[] array, int startIndex, Predicate<TSource> match) =>
Array.FindLastIndex(array, startIndex, match);

/// <inheritdoc cref="Array.FindLastIndex{T}(T[], int, int, Predicate{T})"/>
public static int FindLastIndex<TSource>(this TSource[] array, int startIndex, int count, Predicate<TSource> match) =>
public static int FindLastIndex<TSource>(this TSource[] array, int startIndex, int count,
Predicate<TSource> match) =>
Array.FindLastIndex(array, startIndex, count, match);

/// <inheritdoc cref="List{T}.FindIndex(Predicate{T})"/>
public static int FindIndex<TSource>(this List<TSource> list, Predicate<TSource> match) =>
list.FindIndex(match);

/// <inheritdoc cref="List{T}.FindIndex(int, Predicate{T})"/>
public static int FindIndex<TSource>(this List<TSource> list, int startIndex, Predicate<TSource> match) =>
list.FindIndex(startIndex, match);

/// <inheritdoc cref="List{T}.FindIndex(int, int, Predicate{T})"/>
public static int FindIndex<TSource>(this List<TSource> list, int startIndex, int count, Predicate<TSource> match) =>
public static int FindIndex<TSource>(this List<TSource> list, int startIndex, int count,
Predicate<TSource> match) =>
list.FindIndex(startIndex, count, match);

/// <inheritdoc cref="List{T}.FindLastIndex(Predicate{T})"/>
public static int FindLastIndex<TSource>(this List<TSource> list, Predicate<TSource> match) =>
list.FindLastIndex(match);

/// <inheritdoc cref="List{T}.FindLastIndex(int, Predicate{T})"/>
public static int FindLastIndex<TSource>(this List<TSource> list, int startIndex, Predicate<TSource> match) =>
list.FindLastIndex(startIndex, match);

/// <inheritdoc cref="List{T}.FindLastIndex(int, int, Predicate{T})"/>
public static int FindLastIndex<TSource>(this List<TSource> list, int startIndex, int count, Predicate<TSource> match) =>
public static int FindLastIndex<TSource>(this List<TSource> list, int startIndex, int count,
Predicate<TSource> match) =>
list.FindLastIndex(startIndex, count, match);

/// <summary>
/// Searches for an element that matches the conditions defined by the specified predicate,
/// and returns the zero-based index of the first occurrence within the entire
/// <paramref name="enumerable"/>.
/// Searches for an element that matches the conditions defined by the specified predicate,
/// and returns the zero-based index of the first occurrence within the entire
/// <paramref name="enumerable"/>.
/// </summary>
/// <param name="enumerable"> The <see cref="IEnumerable{T}"/> to search.</param>
/// <param name="match">
/// The <see cref="Predicate{T}"/> delegate that defines the conditions of the element to search for.
/// The <see cref="Predicate{T}"/> delegate that defines the conditions of the element to search for.
/// </param>
/// <typeparam name="TSource">The type of the elements of the <paramref name="enumerable"/>.</typeparam>
/// <returns>
/// The zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, -1.
/// The zero-based index of the first occurrence of an element that matches the conditions defined by match, if found;
/// otherwise, -1.
/// </returns>
public static int FindIndex<TSource>(this IEnumerable<TSource> enumerable, Predicate<TSource> match)
{
Expand All @@ -95,17 +96,18 @@ public static int FindIndex<TSource>(this IEnumerable<TSource> enumerable, Predi
}

/// <summary>
/// Searches for an element that matches the conditions defined by the specified predicate,
/// and returns the zero-based index of the last occurrence within the entire
/// <paramref name="enumerable"/>.
/// Searches for an element that matches the conditions defined by the specified predicate,
/// and returns the zero-based index of the last occurrence within the entire
/// <paramref name="enumerable"/>.
/// </summary>
/// <param name="enumerable"> The <see cref="IEnumerable{T}"/> to search.</param>
/// <param name="match">
/// The <see cref="Predicate{T}"/> delegate that defines the conditions of the element to search for.
/// The <see cref="Predicate{T}"/> delegate that defines the conditions of the element to search for.
/// </param>
/// <typeparam name="TSource">The type of the elements of the <paramref name="enumerable"/>.</typeparam>
/// <returns>
/// The zero-based index of the last occurrence of an element that matches the conditions defined by match, if found; otherwise, -1.
/// The zero-based index of the last occurrence of an element that matches the conditions defined by match, if found;
/// otherwise, -1.
/// </returns>
public static int FindLastIndex<TSource>(this IEnumerable<TSource> enumerable, Predicate<TSource> match)
{
Expand All @@ -124,5 +126,4 @@ public static int FindLastIndex<TSource>(this IEnumerable<TSource> enumerable, P

return lastIndex;
}

}
18 changes: 9 additions & 9 deletions Sharplin/Dictionary/Builders.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace Sharplin.Dictionary;

using System.Collections.Generic;

/// <summary>Helper class containing methods for quickly building a dictionary.</summary>
/// <example>
/// <para>
Expand Down Expand Up @@ -30,8 +28,10 @@
/// </example>
public static class Builders
{
/// <summary>Constructs a <see cref="Dictionary{TKey,TValue}"/> from the provided <
/// paramref name="pairs"/>
/// <summary>
/// Constructs a <see cref="Dictionary{TKey,TValue}"/> from the provided
/// <
/// paramref name="pairs"/>
/// </summary>
/// <example>
/// <code>
Expand All @@ -42,13 +42,13 @@ public static class Builders
/// </code>
/// </example>
/// <returns>A <see cref="Dictionary{TKey,TValue}"/> containing the provided <paramref name="pairs"/></returns>

public static Dictionary<TKey, TValue> DictionaryOf<TKey, TValue>(params KeyValuePair<TKey, TValue>[] pairs)
where TKey : notnull =>
where TKey : notnull =>
pairs.ToDictionary(pair => pair.Key, pair => pair.Value);

/// <summary>Constructs a <see cref="Dictionary{TKey,TValue}"/> from the provided
/// <paramref name="pairs"/>
/// <summary>
/// Constructs a <see cref="Dictionary{TKey,TValue}"/> from the provided
/// <paramref name="pairs"/>
/// </summary>
/// <example>
/// <code>
Expand All @@ -62,7 +62,7 @@ public static class Builders
public static Dictionary<TKey, TValue> DictionaryOf<TKey, TValue>(params (TKey key, TValue value)[] pairs)
where TKey : notnull =>
pairs.ToDictionary(pair => pair.Item1, pair => pair.Item2);

/// <returns>
/// A <see cref="KeyValuePair{TKey,TValue}"/> of the provided <paramref name="key"/> and
/// <paramref name="value"/>
Expand Down

0 comments on commit 7ceb8c9

Please sign in to comment.