Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Threading;
using System.Threading.Tasks;
namespace Starvation
{
class Program
{
static void Main(string[] args)
{
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Starvation
{
class Program
{
static void Main(string[] args)
{
/// ProcessRequest is called for every new request
public void ProcessRequest()
{
DoSomethingAsync().Wait();
}
/*
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, with no condition.
*/
public class Foo : BaseClass { }
public class Bar : BaseClass
{
public Bar() : base() { }
}
public class BaseClass
{
public BaseClass([CallerMemberName] string val = "Foo")
public class StringBuffer
{
private Queue<string> _buffer = new Queue<string>();
private int _offset;
public int Length;
public void Append(string content)
{
public class PhantomReference
{
private readonly ReferenceQueue _queue;
protected PhantomReference(ReferenceQueue queue)
{
_queue = queue;
}
~PhantomReference()
using System;
internal class StartupHook
{
public static void Initialize()
{
Console.WriteLine("Hello world!");
}
}
public class InvertedTextWriter : TextWriter
{
private readonly TextWriter _writer;
public InvertedTextWriter(TextWriter baseTextWriter)
{
_writer = baseTextWriter;
}
public override Encoding Encoding => _writer.Encoding;
internal class StartupHook
{
public static void Initialize()
{
Console.SetOut(new InvertedTextWriter(Console.Out));
}
}