J john sutor Jun 3, 2004 #1 Is there any method in C# similar to the Visual Basic method "With". This was very useful and eliminated a lot of code writing.
Is there any method in C# similar to the Visual Basic method "With". This was very useful and eliminated a lot of code writing.
N Nicholas Paldino [.NET/C# MVP] Jun 3, 2004 #2 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, 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.
J Jon Skeet [C# MVP] Jun 3, 2004 #3 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. Click to expand... 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.)
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. Click to expand... 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.)