A: 

You could do it manually or try using http://www.developerfusion.com/tools/convert/csharp-to-vb/

EDIT: also your code has

View()

at the end of

Public Function MakeStringForMe()

this should be

Return View()

In response to point 2 the code isn't using the renderPartial sub it is using the RenderPartialToString function.

HTH

OneSHOT

OneSHOT
Problem 2 refers to the first function, RenderPartialToString, where something I think is a lambda expression is being used.
Kjensen
A: 

RenderPartialToString needs to return a string, s

Aaron Fischer
+2  A: 

This line:

Dim s As String = blockRenderer.Capture(RenderPartialExtensions.RenderPartial(h, UserControl, viewData))

is NOT equivalent to your original line:

string s = blockRenderer.Capture(
         () => RenderPartialExtensions.RenderPartial(h, userControl, viewData)
     );

The C# example is using a lambda, while the VB example is just calling the method directly, which doesn't return a value. The compiler isn't lying to you.

Try this instead:

Dim s = blockRender.Capture(New Action(Of String)(Function() RenderPartialExtensions.RenderPartial(h, UserControl, viewData)))

I took a look at Capture and it's expecting an Action which is just a delegate, and it looks like the compiler can't infer the delegate's signature to wrap the anonymous function. So we'll give it a helping hand and wrap the lambda ourselves.

Bob King
Thanks for your answer. I knew my attempt was not correct, but thought it would make it easier to get good answers.Dim s = blockRender.Capture(Function() RenderPartialExtensions.RenderPartial(h, UserControl, viewData))This still returns an error "Expression does not produce a value"
Kjensen
Looks like it's not working anymore with VS 2010 / C# 4.0 / MVC 2 (dunno which one causes the problem as I migrated all at the same time)=> Do you know any way to have it back ? I'm massively using this mechanism to render all controls of my application...
Mose
A: 

My favorite converter can be found at this link

The reason it's my favorite is that it can be used "offline"--that is, not at their web page. The converter is exposed as a web service, and there's sample code (in C#) to reference it.

I downloaded their sample code & adapted it to read & write from the file system. Made a conversion a whole lot simpler....

< edit> I know that link doesn't actually go to the converter--it goes to an "about" page, with links from there to the converter page & to the sample code download. Also, I should prob'ly mention that it's a three-cornered converter (VB, C# and Boo), bidirectional between any two languages < /edit>

RolandTumble