with statement

  • Thread starter Thread starter Gas
  • Start date Start date
G

Gas

In VB, we have "with" statement, I am wondering is there a similar thing in
C#?

thx
 
Gas,

No, there is not (thank God). The closest you can get is assigning the
expression to a variable, and using that.

Hope this helps.
 
Nope.

In VB, we have "with" statement, I am wondering is there a similar thing in
C#?

thx
 
When you see a block of code that makes heavy use of a particular
variable - that is to say, a block of code where you wish you could be
using WITH - it should be a strong suggestion to you that that block of
code should be split out and made a method of that variable's class.
It takes a while to get the knack for this, but if you push it hard for
a few days, even where it doesn't seem to make sense (or where it
doesn't seem possible), I think you'll find you like the results.
Peace,
--Carl
 

Ask a Question

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.

Ask a Question

Back
Top