aderesh aderesh - 2 months ago 8
Vb.net Question

What is vb.net 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
}

Answer

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