Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class JsonFilesRepository
{
private const string Root = "../../../json/";
public Dictionary<string, string> Files { get; } = new();
public JsonFilesRepository(params string[] files)
{
var filesList = files.ToList();
if (!filesList.Any())
foreach (var file in Directory.GetFiles(Root))
filesList.Add(Path.GetFileName(file));
foreach (var file in filesList)
{
var path = Path.Combine(Root, file);
var contents = File.ReadAllText(path);
Files.Add(file, contents);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment