Gary King

Gary King

  • NA
  • 83
  • 209.5k

C# Equivalent of VB "WITH"

Jun 24 2011 8:36 AM
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)