I am trying to convert this code
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>());
}
online converters produce this
<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
which gives an error
Overload resolution failed because no accessible 'Select' accepts this number of type arguments.
How can I fix this?
no select accepts ...10to a collection. Note that the value offeedsis ignored and 10 is added all the time. I don't seeCTypewith this converter converter.telerik.com<System.Runtime.CompilerServices.Extension()> _ Public Function NewLine2(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)(DirectCast(Function(x) CByte(10), Func(Of Byte, Byte))).ToArray(Of Byte)()) End Functionit still hasDirectCastinstead, which still gives the error above