Working with Integer

Let's create other constructor for next column from our csv files. In GameResult class.

public int Goals { get; set; }

public int GoalAttempts { get; set; }

public int ShotsOnGoal { get; set; }

public int ShotsOffGoal { get; set; }

Back to our main class.

int parseInt;
if (int.TryParse(values[3], out parseInt))
{
    GameResult.Goals = parseInt;
}
if (int.TryParse(values[4], out parseInt))
{
    GameResult.GoalAttempts = parseInt;
}
if (int.TryParse(values[5], out parseInt))
{
    GameResult.ShotsOnGoal = parseInt;
}
if (int.TryParse(values[6], out parseInt))
{
    GameResult.ShotsOffGoal = parseInt;
}

results matching ""

    No results matching ""