Skip to content

Commit 64ff505

Browse files
committed
docs(extensions): 为并发限制队列添加英文注释
更新 XML 文档注释,为所有公共成员添加英文翻译,以提高国际化支持。
1 parent 9a99188 commit 64ff505

1 file changed

Lines changed: 28 additions & 9 deletions

File tree

GameFrameX.Foundation.Extensions/ConcurrentLimitedQueue.cs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,20 @@ namespace GameFrameX.Foundation.Extensions;
3838
/// <summary>
3939
/// 定长队列,当队列达到指定长度时,新元素入队会自动移除最旧的元素。
4040
/// </summary>
41-
/// <typeparam name="T">队列中元素的类型。</typeparam>
41+
/// <remarks>
42+
/// A fixed-length queue that automatically removes the oldest elements when new elements are enqueued and the queue reaches its maximum length.
43+
/// </remarks>
44+
/// <typeparam name="T">队列中元素的类型 / The type of elements in the queue.</typeparam>
4245
public class ConcurrentLimitedQueue<T> : ConcurrentQueue<T>
4346
{
4447
/// <summary>
4548
/// 初始化一个新的 <see cref="ConcurrentLimitedQueue{T}" /> 实例,指定队列的最大长度。
4649
/// </summary>
47-
/// <param name="limit">队列的最大长度,必须大于0。</param>
48-
/// <exception cref="ArgumentOutOfRangeException">当 <paramref name="limit"/> 小于或等于0时抛出。</exception>
50+
/// <remarks>
51+
/// Initializes a new instance of the <see cref="ConcurrentLimitedQueue{T}" /> class with the specified maximum length.
52+
/// </remarks>
53+
/// <param name="limit">队列的最大长度,必须大于0 / The maximum number of elements the queue can hold, must be greater than 0.</param>
54+
/// <exception cref="ArgumentOutOfRangeException">当 <paramref name="limit"/> 小于或等于0时抛出 / Thrown when <paramref name="limit"/> is less than or equal to 0.</exception>
4955
public ConcurrentLimitedQueue(int limit)
5056
{
5157
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(limit, 0, nameof(limit));
@@ -55,8 +61,11 @@ public ConcurrentLimitedQueue(int limit)
5561
/// <summary>
5662
/// 使用指定的集合初始化一个新的 <see cref="ConcurrentLimitedQueue{T}" /> 实例,并设置队列的最大长度为集合的元素数量。
5763
/// </summary>
58-
/// <param name="list">用于初始化队列的集合,不能为null。</param>
59-
/// <exception cref="ArgumentNullException">当 <paramref name="list"/> 为null时抛出。</exception>
64+
/// <remarks>
65+
/// Initializes a new instance of the <see cref="ConcurrentLimitedQueue{T}" /> class with the specified collection and sets the maximum length to the number of elements in the collection.
66+
/// </remarks>
67+
/// <param name="list">用于初始化队列的集合,不能为null / The collection to initialize the queue with, cannot be null.</param>
68+
/// <exception cref="ArgumentNullException">当 <paramref name="list"/> 为 null 时抛出 / Thrown when <paramref name="list"/> is null.</exception>
6069
public ConcurrentLimitedQueue(IEnumerable<T> list) : base(list ?? throw new ArgumentNullException(nameof(list)))
6170
{
6271
Limit = list.Count();
@@ -65,14 +74,21 @@ public ConcurrentLimitedQueue(int limit)
6574
/// <summary>
6675
/// 队列的最大长度。
6776
/// </summary>
77+
/// <remarks>
78+
/// Gets or sets the maximum number of elements the queue can hold.
79+
/// </remarks>
80+
/// <value>队列的最大长度 / The maximum number of elements the queue can hold.</value>
6881
public int Limit { get; set; }
6982

7083
/// <summary>
7184
/// 将一个列表隐式转换为 <see cref="ConcurrentLimitedQueue{T}" />。
7285
/// </summary>
73-
/// <param name="list">要转换的列表,不能为null。</param>
74-
/// <returns>一个新的 <see cref="ConcurrentLimitedQueue{T}" /> 实例。</returns>
75-
/// <exception cref="ArgumentNullException">当 <paramref name="list"/> 为null时抛出。</exception>
86+
/// <remarks>
87+
/// Implicitly converts a <see cref="List{T}"/> to a <see cref="ConcurrentLimitedQueue{T}"/>.
88+
/// </remarks>
89+
/// <param name="list">要转换的列表,不能为 null / The list to convert, cannot be null.</param>
90+
/// <returns>一个新的 <see cref="ConcurrentLimitedQueue{T}" /> 实例 / A new <see cref="ConcurrentLimitedQueue{T}" /> instance.</returns>
91+
/// <exception cref="ArgumentNullException">当 <paramref name="list"/> 为 null 时抛出 / Thrown when <paramref name="list"/> is null.</exception>
7692
public static implicit operator ConcurrentLimitedQueue<T>(List<T> list)
7793
{
7894
ArgumentNullException.ThrowIfNull(list, nameof(list));
@@ -82,7 +98,10 @@ public static implicit operator ConcurrentLimitedQueue<T>(List<T> list)
8298
/// <summary>
8399
/// 将一个元素添加到队列中。如果队列已满,则移除最旧的元素。
84100
/// </summary>
85-
/// <param name="item">要添加的元素。</param>
101+
/// <remarks>
102+
/// Adds an element to the queue. If the queue is full, the oldest element is removed.
103+
/// </remarks>
104+
/// <param name="item">要添加的元素 / The element to add to the queue.</param>
86105
public new void Enqueue(T item)
87106
{
88107
while (Count >= Limit)

0 commit comments

Comments
 (0)