I have the following method defined in a class:

public bool LogOff(string sessionId)
{
   int res;
   // Some non related code here..
   if (res == 1)
   {
      return true;
   }
   return false;
}

What's strange to me is that I'm getting a "Local variable might not be initialized before accessing" error from Visual Studio (I do have ReSharper installed) on the IF clause. Why is this the case when "res" is a value type and as such should default to 0? I should point out that if I specifically set the value of res to 0 then it's all OK.

What am I missing here? I thought these are the basics of programming but apparently I'm not familiar with the basics...

Edit
Report