我想通過一個字節數組循環,並將內容複製到一個新的字節列表,並將其顯示回來。請參閱下面的代碼。追加字節把空間
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myByte() As Byte = New Byte() {65, 66, 67}
Dim newByte() As Byte = New Byte() {}
Dim tempByteList As New List(Of Byte)
For i As Integer = 0 To 2
ReDim newByte(1)
Array.Copy(myByte, i, newByte, 0, 1)
tempByteList.AddRange(newByte)
Next
Dim str1 As String = System.Text.UnicodeEncoding.UTF8.GetString(tempByteList.ToArray())
End Sub
我希望看到STR1爲「ABC」,但放了我得到的是「ABC」(即字母之間的空格) 請注意:我有一個循環內的複製(塊),並得到結果在最後,這只是一個樣本來重現我的真實問題。
任何幫助將不勝感激
爲什麼這個標籤C# –
@ChristopherCurrens:刪去了 –