Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused functions #20029

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions src/Core/src/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,6 @@ public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
}
}

/// <summary>
///
/// </summary>
/// <typeparam name="TSource"></typeparam>
/// <typeparam name="TKey"></typeparam>
/// <param name="enumeration"></param>
/// <param name="func"></param>
/// <returns></returns>
public static IDictionary<TKey, List<TSource>> GroupToDictionary<TSource, TKey>(this IEnumerable<TSource> enumeration, Func<TSource, TKey> func)
where TKey : notnull
{
var result = new Dictionary<TKey, List<TSource>>();
foreach (TSource item in enumeration)
{
var group = func(item);
if (!result.ContainsKey(group))
result.Add(group, new List<TSource> { item });
else
result[group].Add(item);
}
return result;
}

/// <summary>
/// Find the index of a specific item within the collection.
/// </summary>
Expand Down Expand Up @@ -74,29 +51,6 @@ public static int IndexOf<T>(this IEnumerable<T> enumerable, T item)
return -1;
}

/// <summary>
/// Find the index for the first occurrence of an item within the collection as matched through the specified predicate.
/// </summary>
/// <typeparam name="T">The type of object contained in this collection.</typeparam>
/// <param name="enumerable">The collection in which to look for the item.</param>
/// <param name="predicate">The predicate used to evaluate each item and see if it matches.
/// The item currently evaluated of type <typeparamref name="T"/> is provided as an input parameter.
/// The resulting value should be a <see cref="bool"/> which is <see langword="true"/> if this is the item to match, otherwise <see langword="false"/>.</param>
/// <returns>The index of the first item to match through <paramref name="predicate"/> in the collection or -1 when no match is not found.</returns>
public static int IndexOf<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate)
{
var i = 0;
foreach (T element in enumerable)
{
if (predicate(element))
return i;

i++;
}

return -1;
}

/// <summary>
/// Retrieves the last item from a <see cref="IList{T}"/> instance.
/// </summary>
Expand Down
Loading