0

I trying to convert this C# code VB.Net. its giving syntax error.

C#

@{
var grid = new WebGrid(source: data, 
                           defaultSort: "name",  
                           rowsPerPage: 30) 
}

VB.Net

@Code
Dim grid as new WebGrid(source: data, 
                           defaultSort: "name",  
                           rowsPerPage: 30); 
End Code

What is the correct say to convert this?

-SR

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
sfgroups
  • 18,151
  • 28
  • 132
  • 204

2 Answers2

3

VB.NET has a different syntax for named parameters than does C#. (They were around in VB for a long time before they ever made their way into C#.)

You can rewrite the code like this:

Dim grid As New WebGrid(source := data, defaultSort := "name", rowsPerPage := 30)
Community
  • 1
  • 1
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
0

@sfgroups ... Try out this tool, http://www.developerfusion.com/tools/convert/vb-to-csharp/

Sujay Ghosh
  • 2,828
  • 8
  • 30
  • 47