Criar um app console SEM persistencia (nao precisa de banco de dados)
Um programa que receberá linhas de um json
como entrada stdin
e deverá fornecer uma saída com a conta resultante para cada uma das operações em json
using System.Buffers; | |
using System.Runtime.CompilerServices; | |
using Backdash.Core; | |
// ReSharper disable ParameterHidesMember | |
namespace Backdash.Data; | |
sealed unsafe class NativeMemoryManager<T> : MemoryManager<T> | |
where T : unmanaged | |
{ |
open System | |
open System.Threading | |
type Atom<'t> = | |
private | |
{ mutable CurrentValue: 't } | |
member this.Value = this.CurrentValue | |
[<RequireQualifiedAccess>] |
open System.Net.Sockets | |
open System.Net | |
open System | |
open System.Text | |
open System.Threading | |
let localPort = 8800 | |
let serverPort = 8888 | |
let serverUri = Uri("http://localhost") |
using System.Text.Json; | |
using System.Text.Json.Serialization; | |
/// <summary> | |
/// Json converter for DateTime forcing local time | |
/// </summary> | |
public sealed class DateTimeForceLocalJsonConverter : JsonConverter<DateTime> | |
{ | |
readonly TimeSpan offset; |
using System; | |
using System.Runtime.CompilerServices; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Linq; | |
ValueList<int> nums = new(); | |
nums.Add(10); | |
nums.Add(20); |
readonly struct MemoryBuffer<T> : IDisposable | |
{ | |
readonly bool clearArray; | |
readonly T[] array; | |
public int Length { get; } | |
public Memory<T> Memory { get; } | |
internal MemoryBuffer(int size, bool clearArray = false) | |
{ |
public sealed class CircularBuffer<T>(int capacity = 64) : IReadOnlyList<T> | |
where T : notnull | |
{ | |
readonly T[] elements = new T[capacity]; | |
int head, tail; | |
public int Capacity => elements.Length; | |
public int Length { get; private set; } |
#r "nuget: FSharp.Data" | |
#r "nuget: Humanizer.Core" | |
#r "nuget: EluciusFTW.SpectreCoff" | |
open FSharp.Data | |
open SpectreCoff | |
open Humanizer | |
open System | |
open System.Globalization | |
open Spectre.Console |
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
using System.Collections; | |
using System.Text.Json; | |
using static System.Console; | |
Document[] docs = | |
{ | |
new( |