Skip to content

Commit 5c66ef3

Browse files
committed
feat: 增加 Byte 转换器
1 parent 8f8a8b8 commit 5c66ef3

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
// Website: https://www.blazor.zone or https://argozhang.github.io/
4+
5+
namespace BootstrapBlazor.Socket.DataConverters;
6+
7+
/// <summary>
8+
/// Sokcet 数据转换为 byte 转换器
9+
/// </summary>
10+
public class DataByteConverter : IDataPropertyConverter
11+
{
12+
/// <summary>
13+
/// <inheritdoc/>
14+
/// </summary>
15+
/// <param name="data"></param>
16+
public object? Convert(ReadOnlyMemory<byte> data)
17+
{
18+
return data.Span[0];
19+
}
20+
}

0 commit comments

Comments
 (0)