I have a method that will receive a string, but before I can work with it, I have to convert it to int. Sometimes it can be null and I ha
string
int
null
Why parse the string "0" just to get integer value 0? I definitely prefer this:
public int doSomeWork(string value) { int someValue; if (String.IsNullOrEmpty(value)) { someValue = 0; } else { someValue = Int32.Parse(value); } }