Why does this (null || !TryParse) conditional result in “use of unassigned local variable”?
The following code results in use of unassigned local variable "numberOfGroups" : int numberOfGroups; if(options.NumberOfGroups == null || !int.TryParse(options.NumberOfGroups, out numberOfGroups)) { numberOfGroups = 10; } However, this code works fine (though, ReSharper says the = 10 is redundant): int numberOfGroups = 10; if(options.NumberOfGroups == null || !int.TryParse(options.NumberOfGroups, out numberOfGroups)) { numberOfGroups = 10; } Am I missing something, or is the compiler not liking my || ? I've narrowed this down to dynamic causing the issues ( options was a dynamic variable in