Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

With .... End With in c#?

Status
Not open for further replies.

rahmanjan

Programmer
Apr 13, 2003
180
AU
hi all,

In vb we have something like with and end withs where it facilitates to use the object and by pressing dot can recieve its prperties something like

With Myobject
.name
.age
end with

do we have something like this in C#? Any alternatives?

regrds
 
The language does not have a with..end with construct. But you can do something similar with a temp variable. Instead of:
Code:
Myobject.a.b.c.d.e.f();
Myobject.a.b.c.d.g.h.i();
you can do something like:
Code:
MyDType MyD;
MyD = Myobject.a.b.c.d;
MyD.e.f();
MyD.g.h.i();
which will shorten things up a bit.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top