In Visual Basic, if you are going to change multiple properties of a single object, there\'s a With/End With statement:
Dim myObject as Object
How about this?
static class Extension
{
public static void With(this T obj, Action a)
{
a(obj);
}
}
class Program
{
class Obj
{
public int Prop1 { get; set; }
public int Prop2 { get; set; }
public int Prop3 { get; set; }
public int Prop4 { get; set; }
}
static void Main(string[] args)
{
var detailedName = new Obj();
detailedName.With(o => {
o.Prop1 = 1;
o.Prop2 = 2;
o.Prop3 = 3;
o.Prop4 = 4;
});
}
}