Skip to content

Commit

Permalink
use using declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
smdn committed Apr 2, 2024
1 parent b3672be commit f3ed941
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ public static SpecificationMaster GetInstance()
if (_Instance is null) {
const string specificationMasterJsonFileName = "SpecificationMaster.json";

using (var stream = GetSpecificationMasterDataStream(specificationMasterJsonFileName)) {
_Instance = new(
JsonSerializer.Deserialize<SpecificationMasterJsonObject>(stream) ?? throw new InvalidOperationException($"failed to deserialize {specificationMasterJsonFileName}")
);
}
using var stream = GetSpecificationMasterDataStream(specificationMasterJsonFileName);

_Instance = new(
JsonSerializer.Deserialize<SpecificationMasterJsonObject>(stream) ?? throw new InvalidOperationException($"failed to deserialize {specificationMasterJsonFileName}")
);
}

return _Instance;
}

Expand Down

0 comments on commit f3ed941

Please sign in to comment.