c# - Assign values on multi-properties to a object -
i have object initialized before in base class. in inherited class, use object , assign values on multi-properties it. example:
this.chart.x = 10; this.chart.y = 10; this.chart.width = 20; this.chart.height = 20; this.chart.background = color.red; however, must repeat "this.chart" many times. how avoid this. note don't want re-create object again because in base class, initialized common values.
thanks.
you make set of extension methods chart implement fluent interface. rid of of repeated code, example looks like:
this.chart.x(10).y(10).width(20).height(20).background(color.red); and don't need this.
Comments
Post a Comment