Jun 10, 2003 #1 rahmanjan Programmer Joined Apr 13, 2003 Messages 180 Location 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
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
Jun 10, 2003 #2 chiph Programmer Joined Jun 9, 1999 Messages 9,878 Location US 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. Upvote 0 Downvote
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.