Skip to content

Commit 699fd06

Browse files
committed
refactor: 重命名静态变量
1 parent 794cdde commit 699fd06

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/extensions/BootstrapBlazor.TcpSocket/Extensions/ITcpSocketClientExtensions.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static class ITcpSocketClientExtensions
2020
/// Sends the specified string content to the connected TCP socket client asynchronously.
2121
/// </summary>
2222
/// <remarks>This method converts the provided string content into a byte array using the specified
23-
/// encoding (or UTF-8 by default) and sends it to the connected TCP socket client. Ensure the client is connected
23+
/// encoding (or UTF-8 by default) and sends it to the connected TCP socket client. Ensure the client is connected
2424
/// before calling this method.</remarks>
2525
/// <param name="client">The TCP socket client to which the content will be sent. Cannot be <see langword="null"/>.</param>
2626
/// <param name="content">The string content to send. Cannot be <see langword="null"/> or empty.</param>
@@ -51,7 +51,7 @@ public static ValueTask<bool> ConnectAsync(this ITcpSocketClient client, string
5151
return client.ConnectAsync(endPoint, token);
5252
}
5353

54-
private static readonly Dictionary<ITcpSocketClient, List<(IDataPackageAdapter Adapter, Func<ReadOnlyMemory<byte>, ValueTask> Callback)>> _cache = [];
54+
private static readonly Dictionary<ITcpSocketClient, List<(IDataPackageAdapter Adapter, Func<ReadOnlyMemory<byte>, ValueTask> Callback)>> Cache = [];
5555

5656
/// <summary>
5757
/// 增加 <see cref="ITcpSocketClient"/> 数据适配器及其对应的回调方法
@@ -67,13 +67,13 @@ async ValueTask cb(ReadOnlyMemory<byte> buffer)
6767
await adapter.HandlerAsync(buffer);
6868
}
6969

70-
if (_cache.TryGetValue(client, out var list))
70+
if (Cache.TryGetValue(client, out var list))
7171
{
7272
list.Add((adapter, cb));
7373
}
7474
else
7575
{
76-
_cache.Add(client, [(adapter, cb)]);
76+
Cache.Add(client, [(adapter, cb)]);
7777
}
7878

7979
client.ReceivedCallBack += cb;
@@ -89,7 +89,7 @@ async ValueTask cb(ReadOnlyMemory<byte> buffer)
8989
/// <param name="callback"></param>
9090
public static void RemoveDataPackageAdapter(this ITcpSocketClient client, Func<ReadOnlyMemory<byte>, ValueTask> callback)
9191
{
92-
if (_cache.TryGetValue(client, out var list))
92+
if (Cache.TryGetValue(client, out var list))
9393
{
9494
var items = list.Where(i => i.Adapter.ReceivedCallBack == callback).ToList();
9595
foreach (var c in items)
@@ -131,13 +131,13 @@ async ValueTask cb(ReadOnlyMemory<byte> buffer)
131131
await adapter.HandlerAsync(buffer);
132132
}
133133

134-
if (_cache.TryGetValue(client, out var list))
134+
if (Cache.TryGetValue(client, out var list))
135135
{
136136
list.Add((adapter, cb));
137137
}
138138
else
139139
{
140-
_cache.Add(client, [(adapter, cb)]);
140+
Cache.Add(client, [(adapter, cb)]);
141141
}
142142

143143
client.ReceivedCallBack += cb;
@@ -188,13 +188,13 @@ async ValueTask cb(ReadOnlyMemory<byte> buffer)
188188
await adapter.HandlerAsync(buffer);
189189
}
190190

191-
if (_cache.TryGetValue(client, out var list))
191+
if (Cache.TryGetValue(client, out var list))
192192
{
193193
list.Add((adapter, cb));
194194
}
195195
else
196196
{
197-
_cache.Add(client, [(adapter, cb)]);
197+
Cache.Add(client, [(adapter, cb)]);
198198
}
199199

200200
IDataConverter<TEntity>? converter = null;

0 commit comments

Comments
 (0)