Questions about the design

Oct 20, 2008 at 11:59 PM
I guess the only big issue I have is with the design:
Why not use Regular Expressions in the Base control to check the input text (I think TryParse is slower)?
Why do an abstract ToText, when its always the same (and you have the FormatString)?
I also don't understand NullText - why not assume its String.Empty, and use String.IsNullOrEmpty to check if the text is empty?

The reason why I am asking this questions is that I want to implement something similar in my project
but I want it also to be more generic and I believe there is a Regular Expression for any text pattern out there,
especially numbers.

Regards,
Roy Dallal
Coordinator
Jan 22, 2009 at 3:30 PM

I will try to answer one by one:

  1. The TryParse can be more easily changed (in the future) by changing the NumberStyles and culture.
    When using a regular expression you have to provide your own regular expression for every possible culture.
    I do not think speed is an issue here. How many keystrokes a user can make per second?
  2. Maybe for some future format you need to override the standard behaviour
  3. Maybe you want to handle "?" or "-" as 0.

Gert