I have tried this several ways and keep getting an error each time I try.
This is using .net 3.5 with asp.net(forms) and vb.net.
Examples:
Dim _registrations = New List(Of Integer)
Dim regList As String
Dim ListOfReg = _registrations.convertall(Of String)(Function(i As Integer) i.ToString())
regList = String.Join(",", ListOfReg.ToArray())
Error message:
Overload resolution failed because no Public 'convertall' can be called with these arguments:
'Public Function ConvertAll(Of String)(converter As System.Converter(Of Integer,String)) As System.Collections.Generic.List(Of String)':
Argument matching parameter 'converter' cannot convert from 'VB$AnonymousDelegate_0(Of Integer,String)' to 'Converter(Of Integer,String)'.
Other attempt:
regList = String.Join(",", (_registrations.Select(Function(reg) reg.ToString()).ToArray()))
Error message:
Public member 'Select' on type 'List(Of Integer)' not found.
Any help is appreciated.
Thanks.
this should work , I guess it is the square brackets on the select?
.NET 3.5 solution
Dim integers As List(Of Integer) = New List(Of Integer)
integers.Add(1)
integers.Add(2)
integers.Add(3)
Dim commas As String = String.Join(",", integers.[Select](Function(i) i.ToString()).ToArray())
MessageBox.Show(commas)
Below is the.NET 4.0 Solution
Dim integers As List(Of Integer) = New List(Of Integer)
integers.Add(1)
integers.Add(2)
integers.Add(3)
Dim commas As String = String.Join(",", integers.ToArray)
MessageBox.Show(commas)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With