Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Created January 28, 2022 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonysneed/5f7409dcfa66d800179618b44ec24a41 to your computer and use it in GitHub Desktop.
Save tonysneed/5f7409dcfa66d800179618b44ec24a41 to your computer and use it in GitHub Desktop.
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