c# - Can VB.NET create inline blocks with new scope? -



c# - Can VB.NET create inline blocks with new scope? -

this question has reply here:

scope , how narrow using vb.net 4 answers

in c#, 1 can create new scope placing braces around code. example:

{ foo fooa = new foo(); fooa.dosomething(); fooa.dosomethingelse(); } { // can't refer fooa in here. foo foob = new foo(); foob.dosomething(); foob.dosomethingelse(); }

does vb.net have way create new scope without using reserved words?

you can (nowhere near elegant c# code, same job):

if true dim fooa new foo() fooa.dosomething() fooa.dosomethingelse() end if if true ' can't refer fooa in here. dim foob new foo() foob.dosomething() foob.dosomethingelse() end if

i have question why want though...refactoring jumps out me

c# .net vb.net scope c#-to-vb.net

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -