Skip to content

Instantly share code, notes, and snippets.

@davidfowl
davidfowl / PeekJsonToken.cs
Last active February 29, 2024 17:47
Peeking at a JSON token using a PipeReader in the ASP.NET Core request pipeline
using System;
using System.Buffers;
using System.Collections.Generic;
using System.IO.Pipelines;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>8</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.IO.Pipelines" Version="4.7.1" />
@PizzaConsole
PizzaConsole / CustomResultFilterAttribute.cs
Created August 7, 2020 20:59
Use Custom Json Serialization Setting per Controller in ASP.NET Core 3.0+
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Buffers;
namespace MyProject.Filters
{
@ZacharyPatten
ZacharyPatten / readme.md
Last active February 3, 2023 15:58
GitHub Repository Checklist (C#)

GitHub Repository Checklist (C#)

Have a repository on GitHub? Planning on making a repository on GitHub? This checklist is intended to introduce you to various features that may help you make the most of your GitHub repository with specific recommendations for C# repositories.

Checklist

These are only suggestions.
They may not be appropriate for all repositories.
They are in no particular order.
Click each item to expand for more information.