Snippets
csharp
Complete, checked snippets in this language.
csharp
A complete C# confirmation authority: the model can prepare a proposal, but only the owner's structured action commits it, after revalidation and one conditional write.
Compiled in a scratch .NET 10 project, warnings as errors: 8 concurrent confirms made 1 receipt and 1 commit write; repeat, cancel, expiry, supersede, stale, wrong owner, and 5 invalid proposals as documented; views omit destination; a write that landed then threw retried to the same receipt.
csharp
A complete DelegatingHandler that checks model tool calls and argument shapes before the agent framework or its telemetry sees them.
Compiled in a scratch .NET 10 project, warnings as errors; 14 cases: allowed calls and a final answer passed; unknown tools, two prepares, an extra, numeric, renamed, duplicated, or oversized argument gave 502; an upstream 500 body was replaced; caller cancellation was rethrown.
csharp
A complete C# parser that turns amounts like 5,000.35 into cents with integer math and rejects anything ambiguous.
Compiled in a scratch .NET 10 console project with warnings as errors and run against the source repository's test data: 8 accepted inputs, 22 rejected inputs (including 5.000,35, 5e3, 0, overflow, and non-ASCII digits), and 3 display formats, 0 failures.
csharp
A complete ASP.NET Core endpoint that authenticates a native helper WebSocket before accepting binary PCM frames.
Compiled on .NET 10 with warnings as errors and run through the non-WebSocket bad-request, missing-subprotocol unauthorized, valid-subprotocol upgrade, failed-upgrade gate release, and oversized-message close paths
csharp
A complete C# audio converter that turns native capture buffers into 16 kHz, mono, signed 16-bit PCM frames for live speech recognition.
Compiled on .NET 10 with warnings as errors and run with generated stereo float audio split across many small buffers, verifying no boundary-sized dropout.
csharp
A complete ASP.NET Core loopback host and router for a native helper's pairing and capture contract.
Compiled on .NET 10 with warnings as errors, run against the health route, and verified StartAsync returns before StopAsync stops the host
csharp
A complete C# provider that sends a transcript to Azure OpenAI chat completions and returns structured meeting-summary text.
Compiled on .NET 10 with warnings as errors and run against missing configuration, invalid endpoint, and empty-provider-response paths without a network call
csharp
A complete, runnable ASP.NET Core 10 program: W3C tracing, the agent's spans, trusted baggage, whole-trace sampling, and the trace ID returned to the caller.
Compiled with warnings as errors and run: the API continued caller trace context, cleared caller baggage before outbound HTTP, generated the conversation ID server-side, and configured the service resource after Azure Monitor.
csharp
A complete OpenTelemetry processor that tags child spans with your own conversation ID and ignores whatever the caller sent.
Compiled on .NET 10 with warnings as errors