Better use the class
System.IO.StreamReader
:
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx[
^].
Define enumeration type like
enum Stage = { Freshman, Junior, Senior, ... }
, than create a structure or a class with three fields and constructor with three parameters: string name, integer… I don't know what, whatever 83, 76, 98, etc. mean, and
Stage
. Then, declare some collection with the items of this type, for example,
System.Collections.Generic<>
.
Read the file line by line, split each time in three strings using
string.Split
by ',', and parse integer value using
int.Parse
or
int.TryParse
(or
uint.Parse
,
uint.TryParse
) and enum using
enum.Parse
:
http://msdn.microsoft.com/en-us/library/system.string.split.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.int32.parse.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.uint32.parse%28v=vs.71%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.enum.parse.aspx[
^].
For each line, create an instance of your structure or class out of parsed data and add to the collection.
Next time, try to solve such simple problems by yourself, learn how to find in MSDN help pages all you need.
—SA