title: C#: Use of unassigned local variable, using a foreach and if
body: <p>I have this following code:<br>
  I get the error, "Use of un-Assigned Local variable"
  I'm sure this is dead simple, but im baffled.. </p>
  
  <pre><code>    public string return_Result(String[,] RssData, int marketId)
      {
          string result;
          foreach (var item in RssData)
          {
              if (item.ToString() == marketId.ToString())
              {
                  result = item.ToString();
              }
              else
              {
                  result = "";
              }
  
          }
          return result;
      }
  </code></pre>