You can do as follows:
int max, min;
public void ReadTextFile()
{
string[] lines = File.ReadAllLines(ofd.FileName);
List<int> list = new List<int>();
for (int i = 0; i < lines.Length; i++)
{
string[] words = lines[i].Split(',');
list.Add(int.Parse(words[1]));
}
max = list.Max();
min = list.Min();
}
Hope above help.
No comments:
Post a Comment