We help IT Professionals succeed at work.
Get Started

Convert C# to VB.NET

Last Modified: 2013-11-26
I am using Visual Studio 2010 with the .Net 4.0 Framework.

return table.AsEnumerable().Select(r => columns.Select(c =>
     new { Column = c.ColumnName, Value = r[c] })
     .ToDictionary(i => i.Column, i => i.Value != DBNull.Value ? i.Value : null));

Open in new window

I am trying to convert the code above to something I can use in a web service written in vb.net.  I found this code at Telerik Blogs

Here is the code that I have already converted:

    <OperationContract()> _
    Public Function GetData(ByVal Company As String, ByVal Location As String, ByVal ObjectID As Integer) As IEnumerable(Of Dictionary(Of String, Object))
        Dim mgr As New ObjectManager(Company, Location, ObjectID)
        Dim table As DataTable = mgr.GetDataTable

        Dim columns As DataColumn = table.Columns.Cast(Of DataColumn)()

        ' Insert new line here

    End Function

Open in new window

NOTE:  I have already tried to plug this into a C# to VB.NET convertor it doesn't work.
Watch Question
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE