Skip to content

Instantly share code, notes, and snippets.

@karenpayneoregon
Created December 18, 2025 15:22
Show Gist options
  • Select an option

  • Save karenpayneoregon/0205971644e7da4e5eac1dd0b69f7869 to your computer and use it in GitHub Desktop.

Select an option

Save karenpayneoregon/0205971644e7da4e5eac1dd0b69f7869 to your computer and use it in GitHub Desktop.
December 17 refactored code
using System.Text.Json;
namespace WorkingWithArrays;
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Press ENTER to exit");
Console.ReadLine();
}
private static void Lesson1()
{
if (!Directory.Exists("Json"))
{
Directory.CreateDirectory("Json");
}
var decimals = Classes.MockedData.GetDecimals();
var fileName = Path.Combine("Json", "decimals.json");
List<decimal> queried1 = decimals.Where(x => x > 50m).ToList();
Classes.MockedData.WriteDecimalsToJson(fileName, decimals);
var json = JsonSerializer.Serialize(queried1, Classes.MockedData.JsonSerializerOptions);
Console.WriteLine(json);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment