If no return value is found when it must be found, I return an exception.
If no value to be found is sometimes expected, I return null (this will avoid the assumption of a valid string when doing if (str != “”)
Are these valid return scenarios for a method which returns a string?
Thanks
I would personally avoid using Exceptions for program flow in this way. Exceptions should be reserved for circumstances where you cannot continue.
Also, for string testing I’d use string.IsNullOrEmpty