-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I really wanna clean up object creation.
new A() { new B(){}; };
Is just syntactic sugar for:
new A() {};
new B() {};
A.add(B);
So instead of this:
oc_Newobject4["#Newobject1"] = oc_Newobject1;We could have this:
SimSet set = oc_Newobject4.create();
set.add(oc_Newobject1.create());And we should use named parameters in the constructors so that instead of this:
ObjectCreator oc_Newobject4 = new ObjectCreator("GuiWindowCtrl", "ConsoleDlgWindow", typeof (ConsoleDlgWindow));
oc_Newobject4["isContainer"] = "1";
oc_Newobject4["AllowPopWindow"] = "1";We should have:
// Have to have GuiWindowCtrl constructor in a seperate class to avoid boilerplate constructors in
// classes derived from GuiWindowCtrl.
GuiWindowCtrl oc_Newobject4 = new GuiWindowCtrlInstance(name: "ConsoleDlgWindow", isContainer: true, AllowPopWindow: true);
// Alternately
GuiWindowCtrl oc_Newobject4 = (new GuiWindowCtrlInstance("ConsoleDlgWindow")
{
isContainer = true,
AllowPopWindow = true
}).create();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels