[Solved] Convert LINQ C# to VB.Net


Here’s a working sample: http://dotnetfiddle.net/LNksSW

The reason for the error you’re getting is that you’re missing Imports System.Linq at the top of your file.

Dim dt as DataTable = new DataTable
dt.Columns.Add("col1")
dt.Rows.Add("1000000")
dt.Rows.Add("0010000")
dt.Rows.Add("0100000")      

Dim result = dt _
    .AsEnumerable() _
    .Select(Function(r) r.Field(Of String)(0)) _
    .Select(Function(s) string.Join("", s.Select(Function(x, i) _
        If(x = "0", "0", (i + 1).ToString())))).ToList()

For Each i As String in result
    Console.WriteLine(i)
Next

3

solved Convert LINQ C# to VB.Net