I am using int.TryParse to parse to variables (saved as strings in the database) and am curious why I cannot initialise 2 variables:
int min,
max;
using the following conditional statement:
bool lengthCompatible = int.TryParse(string1, out min) &&
int.TryParse(string2, out max);
Visual Studio (2015) produces the following code highlighting:
Use of unassigned local variable 'max'
Local variable 'max' might not be initialized before accessing
However, if I use 2 conditional statements:
bool minParse = int.TryParse(sentenceType.MinimumLength, out min);
bool maxParse = int.TryParse(sentenceType.MaximumLength, out max);
I can compile with no errors.
Curiouser and curiouser! Any insight appreciated.
Cheers