Skip to content

Instantly share code, notes, and snippets.

View Erwinvandervalk's full-sized avatar

Erwin van der Valk Erwinvandervalk

View GitHub Profile
@Erwinvandervalk
Erwinvandervalk / PushStreamContent.cs
Created December 8, 2017 09:10
Validate json while sending it over http
/// <summary>
/// Allows you to pass an asynchronous action that writes to the output stream.
/// </summary>
public class PushStreamContent : HttpContent
{
private readonly Func<Stream, Task> _writeToStreamAsync;
private readonly int _length;
/// <summary>
/// Creates an instance of the PushStreamContent
@Erwinvandervalk
Erwinvandervalk / ElapsedEnricher.cs
Created November 19, 2021 08:22
Serilog TestLoggerProvider
public class ElapsedEnricher : ILogEventEnricher
{
public const string PropertyName = "Elapsed";
private readonly Stopwatch _stopwatch;
public ElapsedEnricher()
{
_stopwatch = Stopwatch.StartNew();
}