Skip to content

Commit

Permalink
代码纠错
Browse files Browse the repository at this point in the history
  • Loading branch information
YaKun9 committed Jul 18, 2024
1 parent 4df433f commit a4111b0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions SageTools/Extension/Collection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,20 @@ public static void PagingToOperate<T>(this ICollection<T> list, Action<ICollecti
/// </summary>
/// <typeparam name="T">集合中元素的类型。</typeparam>
/// <param name="list">要操作的集合。</param>
/// <param name="action">要对集合中的每个元素执行的操作。操作接受集合和当前元素的索引作为参数。</param>
public static void ForEach<T>(this ICollection<T> list, Action<ICollection<T>, int> action)
/// <param name="action">
/// 要对集合中的每个元素执行的操作。操作接受两个参数:
/// 第一个参数是当前元素的索引(int),第二个参数是当前元素(T)。
/// </param>
public static void ForEach<T>(this IList<T> list, Action<int, T> action)
{
if (list.IsNullOrEmpty())
{
return;
}

for (var i = 0; i < list.Count; i++)
{
action(list, i);
action(i, list[i]);
}
}
}
Expand Down

0 comments on commit a4111b0

Please sign in to comment.