c# - Initializing a List into a static method -
i have 6 operators trying push operator class. need initialise list of new operators can used effectively. i've got myself in quite mess , having fair few syntax problems, appreciated in creating list.
public static list<comparisonoperator> createcomparisonoperators() { this.condition1select.items.clear(); this.condition2select.items.clear(); this.condition3select.items.clear(); this.condition4select.items.clear(); foreach (comparisonoperator op in ops) { this.condition1select.items.add(op); this.condition2select.items.add(op); this.condition3select.items.add(op); this.condition4select.items.add(op); } return new list<comparisonoperator>(); }
the this
statement means refer current instance. static methods don't have instance , can't use this
statement. need make list
static, too. comparisonoperator enumeration ops
needs static.
Comments
Post a Comment