M
Mr Flibble
Is there an equivalent of VB's "with" statement in c# ?
Mr said:Is there an equivalent of VB's "with" statement in c# ?
Is there an equivalent of VB's "with" statement in c# ?
Mr said:Is there an equivalent of VB's "with" statement in c# ?
* David Anton said:Also see:
http://www.tangiblesoftwaresolutions.com/Articles/CSharp Equivalent to VB With.htm
(excuse the product plug at the bottom)
Basically, the gist of it is that "With" is no better than an abbreviated
variable named "x" - it's obscure and also implies somehow that the block
centers around the object being With'ed (when it really just centers around
something you didn't want to re-type).
David Anton said:It's just a possibility that may or may not be appropriate.
For example, instead of:
somehorriblelongnameyoudontwanttoretype.methodone()
somehorriblelongnameyoudontwanttoretype.methodtwo()
somehorriblelongnameyoudontwanttoretype.methodthree()
somehorriblelongnameyoudontwanttoretype.methodfour()
You *could* just call a new method:
YourMethod(somehorriblelongnameyoudontwanttoretype)
and then the new method defined as:
Public Sub YourMethod(ByVal activeobject As Whatever)
activeobject.methodone()
activeobject.methodtwo()
activeobject.methodthree()
activeobject.methodfour()
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.