Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • 1
    FYI, this solution won't work when given a public class MyCustomTextBox : TextBox Commented Aug 31, 2011 at 3:20
  • 1
    You would just do case "TextBox: "MyCustomTextBox": ... Commented Aug 31, 2011 at 3:25
  • 10
    Assuming you know all possible subclasses, sure. Commented Aug 31, 2011 at 3:29
  • 3
    I imagine that the person writing this code is writing it for a reason... and knows all of the subclasses :P - Example, he's probably trying to add a CssClass name for all "textboxes" and then all "datepickers" or whatever. Commented Aug 31, 2011 at 3:44
  • 3
    I know this is old, but I like your answer, and I agree with your reasoning that the person writing this would know all of their subclasses, as long as they're using the switch statement to specify action for specific classes, and not all children classes Commented May 16, 2013 at 5:06