Possible Duplicate:
C# equivalent for Visual Basic keyword: 'With' ... 'End With'?
With Alpha.Beta.Gama.Eta.Zeta
a = .ZetaPropertyA
b = .ZetaPropertyB
c = .ZetaPropertyC
End With
a = Alpha.Beta.Gama.Eta.Zeta.ZetaPropertyA
b = Alpha.Beta.Gama.Eta.Zeta.ZetaPropertyB
c = Alpha.Beta.Gama.Eta.Zeta.ZetaPropertyC
Nope, doesn't exist.
Though you could shorten it a bit:
var z = Alpha.Beta.Gama.Eta.Zeta;
z.ZetaPropertyA = a;
z.ZetaPropertyB = b;
z.ZetaPropertyC = c;
for your other case:
var z = Alpha.Beta.Gama.Eta.Zeta;
a = z.ZetaPropertyA;
b = z.ZetaPropertyB;
c = z.ZetaPropertyC;
That should've been obvious though ;)
For new instances you can use object initializer:
Alpa.Beta.Gama.Eta = new Zeta
{
ZetaPropertyA = a,
ZetaPropertyB = b,
ZetaPropertyC = c
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With