Timeline for Constructor parameter validation in C# - Best practices
Current License: CC BY-SA 2.5
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 23, 2011 at 19:19 | comment | added | Steven Striga | Then the answer must be yes - it is acceptable to throw a exception. To avoid having to try/catch this error, then you could use a factory pattern to handle the object creation for you, which would include an empty string case. | |
Feb 23, 2011 at 19:12 | comment | added | Sergio Acosta | I think the question implies that the class actually requires the string to be not empty. That is not the case in your StringBuilder example. | |
Feb 23, 2011 at 19:04 | history | answered | Steven Striga | CC BY-SA 2.5 |