mardi 2 juin 2015

Understanding if statement syntax in c#

So I have a question for you all. Below I have a code that I recently acquired from here, and when I leave it alone it works fine, however once I place it in an if statement, it somehow doesn't like to work.

if (apollo.Contains("Savings found"))
{
    int apolloSavings = apollo.Count(line => line.Contains("Savings found:"));
    Console.WriteLine("In Apollo, there were " + apolloSavings + " PNRS);
}

I am thinking that since the code inside the if statement is acting like a loop, that it counters the if statement, but I am not sure. When you explain what the problem, please also give a description on what I can do to change that syntax to make it work in the if statement.

Aucun commentaire:

Enregistrer un commentaire