Skip to content

Commit bb9b8c2

Browse files
committed
refactor: 修改泛型参数命名并添加约束条件
将泛型参数 TK 重命名为 Tk 以符合命名规范,并为 Max 和 Min 方法添加 IComparable<Tk> 约束,确保类型安全
1 parent 0c5d50f commit bb9b8c2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Runtime/Config/Config/BaseDataTable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ public void ForEach(Action<T> func)
152152
DataList.ForEach(func);
153153
}
154154

155-
public TK Max<TK>(Func<T, TK> func)
155+
public Tk Max<Tk>(Func<T, Tk> func) where Tk : IComparable<Tk>
156156
{
157157
return DataList.Max(func);
158158
}
159159

160-
public TK Min<TK>(Func<T, TK> func)
160+
public Tk Min<Tk>(Func<T, Tk> func) where Tk : IComparable<Tk>
161161
{
162162
return DataList.Min(func);
163163
}

0 commit comments

Comments
 (0)