6
Reply

C# Equivalent of VB "WITH"

Gary King

Gary King

Jun 24 2011 8:36 AM
1.5k
In C# is there an equivalent of the VB With / End With?
 
The only thing that I can find is Using, but this does not appear to work in the same way as With....
For example, in VB I can define which object I am working with and then not use the object name again - something like this....

With myObject

   .Color = "Red"

   .FontSize = "12"

End With


In the above example, I only have to type "myObject" once.

Is this also possible in C#?


Thanks
Gary

Answers (6)
Next Recommended Forum