VB.NET With statement
The following code will run flawlessly but at the end, Obj will still contain the assigned properties (.prop1 = 0 and .prop2 = “hello”) and is not a new instance of ObjType. The attempt to assign a new instance of ObjType to obj has no effect as the reference to obj will be reverted to the original value when the code gets out of the With block.
With Obj
.prop1 = 0
.prop2 = “hello”
obj = new ObjType()
End With