Matt Donnelly

Matt Donnelly

  • NA
  • 4
  • 1.9k

closing StreamReader

Apr 15 2015 4:51 PM
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)