Skip to main content
18 events
when toggle format what by license comment
Oct 11, 2017 at 3:03 vote accept Bubble Bub
Oct 10, 2017 at 19:17 history edited Pouya Samie CC BY-SA 3.0
added 286 characters in body
Oct 10, 2017 at 18:56 history edited Pouya Samie CC BY-SA 3.0
improve answer
Oct 10, 2017 at 18:51 history edited Pouya Samie CC BY-SA 3.0
improve answer
Oct 10, 2017 at 18:32 comment added Pouya Samie @JPhi1618 you are right i will update my answer
Oct 10, 2017 at 18:31 comment added JPhi1618 Well, I know that, I was suggesting it should be a part of your answer rather than you still having "hard coded" string values there.
Oct 10, 2017 at 18:18 comment added Pouya Samie @JPhi1618 you should read the key and your dropdown list key from one place. you can use an enum or constant or database for that by the way your calculate method won't ever change.
Oct 10, 2017 at 18:17 comment added Pouya Samie @IgorSoloydenko agree. it was quick naming i will update the class name
Oct 10, 2017 at 18:16 history edited Pouya Samie CC BY-SA 3.0
added 8 characters in body
Oct 10, 2017 at 15:18 comment added Igor Soloydenko This is a good, extensible approach. Just don't call it a Manager (nor Helper, nor Utils). It's an ActionRegistry, or ArithmeticOperations.
Oct 10, 2017 at 14:17 comment added JPhi1618 One of the askers concerns was If I change the text in the drop down list, I need to change the function as well, and I don't see how that is addressed here. If the words in the text box change, this code still has to be revisited manually.
Oct 10, 2017 at 9:14 comment added Pouya Samie @auhmaan for sure that should be done like that but I did not want to make it complex
Oct 10, 2017 at 9:12 comment added auhmaan What about instead of using a String as an identifier, why not creating an Enum and then using it? This would put aside problems like aDD instead of Add or subtrat instead of Subtract.
Oct 10, 2017 at 7:09 history edited Mast CC BY-SA 3.0
deleted 24 characters in body
Oct 10, 2017 at 6:53 comment added Pouya Samie @JanDotNet thank you. I did not want to complex the answer this is the sketch by the way it is differently better. there should be some extra works for handle adding action with the same key. about not existing action : it is base on application business maybe just returning null or throwing exception
Oct 10, 2017 at 6:49 comment added JanDotNet Simple and pragmatic solution :), You could also pass a string comparer to the dictionary's constructor to become a case insensitive dictionary: public ActionManager() : base(StringComparer.InvariantCultureIgnoreCase). How would you handle the case "action not available"?
Oct 10, 2017 at 6:39 review First posts
Oct 10, 2017 at 10:35
Oct 10, 2017 at 6:38 history answered Pouya Samie CC BY-SA 3.0