Game Development Reference
In-Depth Information
To load our data from the file, we will use
StreamReader
.
StreamReader
is
very similar to
StreamWriter
, except that it loads data from a file instead of
writing to a file. We pass the directory and filename that we want to load into our
StreamReader
class. Next, we read each line using the
ReadLine
function within
the
StreamReader
class. For every line that we read, we can assign it to a variable,
therefore loading the data.