aderesh aderesh - 1 month ago 6 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