3
Answers

closing StreamReader

Matt Donnelly

Matt Donnelly

9y
552
1
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)