With keyword

  • Thread starter Thread starter john sutor
  • Start date Start date
J

john sutor

Is there any method in C# similar to the Visual Basic method "With". This
was very useful and eliminated a lot of code writing.
 
John,

No, there is not. The best you can do is store what you want to use in
a variable, and then make the calls from that variable.

Hope this helps.
 
john sutor said:
Is there any method in C# similar to the Visual Basic method "With". This
was very useful and eliminated a lot of code writing.

No. See http://www.pobox.com/~skeet/csharp/faq/#vb.with

(You can easily get to the stage of only typing in a single character
more per line without "with" than with it, just by declaring a variable
with a single character name and using that repeatedly.)
 
Back
Top