Can you spot a bug?

Can you spot a bug here?

Took me 20 minutes to find it.smile_whatchutalkingabout

 

private List<string> GetLanguages(string path)
{
    var languages = new List<string>();
    if(File.Exists(path))
    {
        using(var reader = new StreamReader(path,_encoding))
        {
            var dscReader = new DscReader(reader);
            while(dscReader.Read())
            {
                string language = dscReader.Item.Language;
                if (!string.IsNullOrEmpty(language) && !language.Contains(language))
                    languages.Add(language);
            }
        }
    }
    return languages;
}
Technorati Tags:
  • Is it one small letter ‘s’ missing?

  • Yes it is.
    I’m gonna have to rethink my variable-naming strategy to protect from such cases.