I had a piece of C# code converted, but the translated code isn't valid... Can somebody help out?
C#
<table>
<% Html.Repeater<Hobby>("Hobbies", "row", "row-alt", (hobby, css) => { %>
<tr class="<%= css %>">
<td><%= hobby.Title%></td>
</tr>
<% }); %>
</table>
VB
<% Html.Repeater(of Hobby)(Model.Hobbies, "row", "row-alt", Function(hobby, css) Do %>
<tr class="<%= css %>">
开发者_JS百科 <td><%= hobby.Title%></td>
</tr>
<% End Function)%>
It looks like you are attempting to use a statement lambda in VB.net. These are not supported in VB.net until Visual Studio 2010. The previous version of the language only supports expression lambdas which don't work in this scenario
If you are using 2010 you need to remove the Do
immediately following the Function
header. It's not necessary and will instead force the lambda to be an expression lambda instead of a statement lambda.
精彩评论