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

Add Obsolete tag for old IndexOf #20068

Merged
merged 2 commits into from
Jan 23, 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
18 changes: 12 additions & 6 deletions src/Core/src/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
}

/// <summary>
///
/// Groups elements from an IEnumerable based on a specified key selector function and returns a dictionary
/// where keys are the computed keys and values are lists of elements with the same key.
/// Used by XAML Hot Reload.
/// </summary>
/// <typeparam name="TSource"></typeparam>
/// <typeparam name="TKey"></typeparam>
/// <param name="enumeration"></param>
/// <param name="func"></param>
/// <returns></returns>
/// <typeparam name="TSource">The type of elements in the input enumeration.</typeparam>
/// <typeparam name="TKey">The type of keys produced by the key selector function.</typeparam>
/// <param name="enumeration">The input IEnumerable of elements to be grouped.</param>
/// <param name="func">A function that extracts a key from an element of the input enumeration.</param>
/// <returns>A dictionary with keys as computed by the key selector function and values as lists of elements
/// that share the same key.</returns>
[Obsolete("Legacy API used in previous versions of XAML Hot Reload. Do not use.")]
public static IDictionary<TKey, List<TSource>> GroupToDictionary<TSource, TKey>(this IEnumerable<TSource> enumeration, Func<TSource, TKey> func)
where TKey : notnull
{
Expand Down Expand Up @@ -76,13 +80,15 @@ public static int IndexOf<T>(this IEnumerable<T> enumerable, T item)

/// <summary>
/// Find the index for the first occurrence of an item within the collection as matched through the specified predicate.
/// Used by XAML Hot Reload.
/// </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>
[Obsolete("Use IndexOf<T>(IEnumerable<T>, T item) instead.")]
public static int IndexOf<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate)
{
var i = 0;
Expand Down
Loading