aderesh aderesh - 6 months ago 31 Question

What is equivalent for c# anonymous code blocks?

What is VB.NET equivalent for this code

void foo()
{ //anonymous code block starts here
} //anonymous code block ends here


There isn't an equivalent anonymous code blocks in VB.NET.

You can emulate with an if true:

If True Then
End If

Or if you don't need a block scope, you can use the regions:

#Region "This is the code to be collapsed"
#End Region