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