private void GetDataFromFolder(string folder) { Folder = folder; JsonManager json = new JsonManager(); foreach (string file in Directory.GetFiles(Folder, "*.json")) { Recipe recipeX = (Recipe)json.LoadObject(file); if (recipeX != null) { AllRecipesList.Add(recipeX); } } }
public List <Product> GetAll() // Working good { All.Clear(); JsonManager json = new JsonManager(); foreach (string file in Directory.GetFiles(Folder, "*" + Extention)) { Product product = (Product)json.LoadObject(file); if (product != null) { All.Add(product); } } return(All); }