Equivalence of "With...End With" in C#? [duplicate]
I know that C# has the using
keyword, but using
disposes of the object automatically.
Is there the equivalence of With...End With
in Visual Basic 6.0?
It's not equivalent, but would this syntax work for you?
Animal a = new Animal()
{
SpeciesName = "Lion",
IsHairy = true,
NumberOfLegs = 4
};
C# doesn't have an equivalent language construct for that.