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!

Setting multiple properties in C#

Status
Not open for further replies.

troydotnet

Programmer
Feb 5, 2003
1
US
I a VB programmer from way back and I got used to being able to use the WITH keyword to set multiple properties on an object.

EX:

With objObject
.Height = 300
.Width = 500
.Text = "Hello"
End With

Is there anything similar in C#?

Thanks
 
No.

Under help, look up "Keywords Compared in Different Languages". That will give you a lot of stuff you might need.
 
Nope. You have to set them individually.

If you do the same set of properties over and over again, it'll be useful to define a private method that does it. That way the code is all in the same place.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top