Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
380 B
7
Indexable
Never
        if (!File.Exists(path))
            throw new ArgumentException($"Config file cannot be found at path '{path}'.");
        var content = File.ReadAllText(path);

        var config = JsonConvert.DeserializeObject<Config>(content);
        if (config == null) {
            throw new ArgumentException($"Argument 'json' has an invalid value: '{json}'.");
        }