gpt4 book ai didi

vb.net - VB.NET 中的“List(Of Byte() )' to ' Byte()”

转载 作者:行者123 更新时间:2023-12-02 03:48:26 29 4
gpt4 key购买 nike

我有一个字节列表:

Public Function GenPackets()
Dim Stream As NetworkStream = ConnectionSocket.GetStream()
Dim DataList As New List(Of Byte())
Dim Data As Byte()
DataList.Add(IntegerToByte(My.Settings.BotUID))

' TO DO Stream.Write(Data, 0, 3)
Return Data
End Function

如何将 DataList 及其所有字节转换为单个 Byte() 以在 Stream.Write 中使用?

最佳答案

无需转换数据,只需迭代列表即可:

For Each buffer As Byte() In Datalist
yourStream.Write(buffer)
Next

这比首先连接所有单独的数组来创建一个大数组要高效得多。

关于vb.net - VB.NET 中的“List(Of Byte() )' to ' Byte()”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14961261/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com