fix file not closed (#571)
This commit is contained in:
@@ -56,6 +56,8 @@ namespace k8s
|
||||
|
||||
/// <summary>
|
||||
/// Load a collection of objects from a stream asynchronously
|
||||
///
|
||||
/// caller is responsible for closing the stream
|
||||
/// </summary>
|
||||
/// <param name="stream">
|
||||
/// The stream to load the objects from.
|
||||
@@ -80,9 +82,11 @@ namespace k8s
|
||||
/// <returns>collection of objects</returns>
|
||||
public static Task<List<object>> LoadAllFromFileAsync(string fileName, Dictionary<string, Type> typeMap)
|
||||
{
|
||||
var reader = File.OpenRead(fileName);
|
||||
using (var reader = File.OpenRead(fileName))
|
||||
{
|
||||
return LoadAllFromStreamAsync(reader, typeMap);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load a collection of objects from a string
|
||||
|
||||
Reference in New Issue
Block a user