Recommend an Appropriate Object-Orientated Design Pattern To Replace This Code....

Posted by Rob P. on Stack Overflow See other posts from Stack Overflow or by Rob P.
Published on 2010-03-09T04:43:15Z Indexed on 2010/03/09 4:51 UTC
Read the original article Hit count: 300

I have a menu click event that looks something like this....

Public Sub ToolbarManager_ToolClick(sender as Object, e as EventArgs)
    Case "New"
        CreateNewFile()
    Case "Save"
        SaveCurrentFile()
    Case "Exit"
        ExitApp()
    Case.......
    etc...
    etc...
End Sub

This strikes me as being 'ugly' - but I'm unsure of the 'best' way or the most appropriate way to clean it up.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about object-oriented-design