Skip to content

Instantly share code, notes, and snippets.

@KarolisKaj
KarolisKaj / FlattenArray
Created May 5, 2019 05:25
Flatten array of ints c#
using System;
using System.Collections.Generic;
namespace Playground
{
class Program
{
static void Main(string[] args)
{
var result = new Solution().FlattenArray(new object[]
@KarolisKaj
KarolisKaj / SynchronizationContext
Last active July 28, 2018 04:54
Idea to implement event pump for logging
public class LoggerContext : IDisposable
{
private readonly Thread _contextPump;
private readonly ManualResetEventSlim _resetHandle = new ManualResetEventSlim(false);
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
private ConcurrentQueue<Action> _logsQueue = new ConcurrentQueue<Action>();
private readonly bool _flush;
public LoggerContext(bool flush = false)