0
我試圖把這段代碼轉換轉換C#的字節數組功能,VB.NET
public static byte[] NewLine(this byte[] bytes, int feeds = 1)
{
return bytes.AddBytes(((IEnumerable<byte>) new byte[feeds]).Select<byte, byte>((Func<byte, byte>) (x => (byte) 10)).ToArray<byte>());
}
在線轉換器產生這種
<System.Runtime.CompilerServices.Extension> _
Public Function NewLine(ByVal bytes() As Byte, Optional ByVal feeds As Integer = 1) As Byte()
Return bytes.AddBytes((DirectCast(New Byte(feeds - 1){}, IEnumerable(Of Byte))).Select(Of Byte, Byte)CType(Function(x) CByte(10), Func(Of Byte, Byte)).ToArray())
End Function
它給出了一個錯誤
重載決策失敗因爲沒有可訪問的'選擇'接受這個類型參數的數量。
任何人都可以幫我嗎?
你有一個System.Linq的導入嗎? –
是的,這就是爲什麼它說'沒有選擇接受...' – Smith
這是一個非常複雜的方式添加'10'的集合。請注意,'feeds'的值會被忽略,並且會一直添加10。我沒有看到'CType'這個轉換器http://converter.telerik.com/ – Slai