I find myself needing to preform the same actions on both HtmlControls and WebControls. I am a firm believer in DRY and find the fact that there is only the Control class to use if I want to consolidate the functions on both types. The problem that I have with using Control is that there certain properties that both HtmlControl and WebControl expose that Control does not. In the current case, the Attributes property is the problem. Does anyone have any suggestions on how to avoid the duplication of code in this type of instance?
I find myself needing to preform the same actions on both HtmlControls and WebControls.
Share
In the past I’ve duplicated code to set the attributes for HtmlControls and WebControls. However, here’s another idea: