Skip to content
Browse files

Fix for FxCop warning.

FxCop warning - Do not dispose objects multiple times
  • Loading branch information...
1 parent 2327c00 commit 360205fd70bde8104aeff9b07b48fed1ea299d25 @alesprimozic alesprimozic committed Aug 23, 2012
Showing with 4 additions and 11 deletions.
  1. +3 −9 ToDoLib/TaskList.cs
  2. +1 −2 ToDoTests/TaskListTests.cs
View
12 ToDoLib/TaskList.cs
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.IO;
-using System.Text.RegularExpressions;
+using System.Linq;
namespace ToDoLib
{
@@ -38,9 +36,7 @@ public void ReloadTasks()
try
{
- _tasks = new List<Task>();
- //foreach (var line in File.ReadAllLines(_filePath))
- // _tasks.Add(new Task(line));
+ _tasks = new List<Task>();
var file = File.OpenRead(_filePath);
using (var reader = new StreamReader(file))
@@ -50,9 +46,7 @@ public void ReloadTasks()
{
_tasks.Add(new Task(raw));
}
-
- }
- file.Close();
+ }
Log.Debug("Finished loading tasks from {0}", _filePath);
}
View
3 ToDoTests/TaskListTests.cs
@@ -314,8 +314,7 @@ public void Read_when_file_is_open_in_another_process()
s.WriteLine("hello");
s.Flush();
}
- Thread.Sleep(500);
- f.Close();
+ Thread.Sleep(500);
}
catch (Exception ex)
{

0 comments on commit 360205f

Please sign in to comment.
Something went wrong with that request. Please try again.