Input validation for method in separate class
| Author | Topic |
|---|---|
| K Z Member Joined: 10 Sep 2008 Country: Posts: 1 | Hi, I have an API that I will use to develop applications internally as well as send to customers so they can develop as well. In this API, I have a method (below, which I slimmed it down alot). Hi, I have an API that I will use to develop applications internally as well as send to customers so they can develop as well. In this API, I have a method (below, which I slimmed it down alot).MY QUESTION: Is it possible to validate the timeoutSeconds input to be greater than 0? I can't validate the input on run time because this method gets called repeatedly and the user will be bombarded with messages/asserts/etc. I want to validate this input at <b>compile time</b>. public string GetMessageFromQueue(uint timeoutSeconds) { retString = ""; while (Q.count <= 0 || timeoutElapsed) { } if (Q.count > 0) { retString = Q.Dequeue(); } return retString } Edited by - some1s69 on 13 Nov 2008 20:12:34 Edited by - some1s69 on 13 Nov 2008 20:12:44 |
Posted: 13 Nov 2008 19:27:27










