Fixed IDisposable implementation and usage.
- Implement IDisposable interface correctly, with sealed classes where possible for simplicity. - Add using statement around undisposed local variables.
This commit is contained in:
@@ -172,13 +172,11 @@ namespace OpenRA
|
||||
|
||||
public static List<MiniYamlNode> FromFileInPackage(string path)
|
||||
{
|
||||
StreamReader reader = new StreamReader(GlobalFileSystem.Open(path));
|
||||
List<string> lines = new List<string>();
|
||||
|
||||
while (!reader.EndOfStream)
|
||||
lines.Add(reader.ReadLine());
|
||||
reader.Close();
|
||||
|
||||
using (var stream = GlobalFileSystem.Open(path))
|
||||
using (var reader = new StreamReader(stream))
|
||||
while (!reader.EndOfStream)
|
||||
lines.Add(reader.ReadLine());
|
||||
return FromLines(lines.ToArray(), path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user