Deserialze JSON from disc

void Log(string error) => $"[ERROR LOG]: {error}".Dump(); void DisplayQuaxx(Quaxx quaxx) => $"QUAXX: ({quaxx.X}, {quaxx.Y})".Dump(); Try<string> Read(string fileName) => () => File.ReadAllText(fileName); Try<Quaxx> DeserializeQuaxx(string s) => () => JsonConvert.DeserializeObject<Quaxx>(s); const string quaxxFile = @"D:\Foo.txt"; Read(quaxxFile).Bind(DeserializeQuaxx) .Run() .Map(ProcessQuaxx) .Match(exception: (error) => Log(error.Message), success: DisplayQuaxx);

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.