3
Reply

closing StreamReader

Matt Donnelly

Matt Donnelly

Apr 15 2015 4:51 PM
545
private void Motorbike_Load(object sender, EventArgs e)
{
string line;
var file = new System.IO.StreamReader("C:\\Temp\\mybikes.xml");
while ((line = file.ReadToEnd()) != null)
{
listBike.Items.Add(line);
}
 
How do i close the StreamRead once it has finished getting the information 
and putting it into the listbox

Answers (3)