Skip to content

Instantly share code, notes, and snippets.

@inwenis
inwenis / TestTimerGC.cs
Last active September 10, 2018 14:57
When your Timer is GC.Collected its action will never fire
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
// This piece of code shows that if you do not assign a variable to your Timer (like in Runner.ExecuteWithTimeout_NotWorking)
// your timer may be Garbage Collected before its action fires.
@inwenis
inwenis / some.cs
Created May 14, 2018 21:19
what is this interface for?
internal interface IAppSettingsReader
{
GasPeriodDto GetGasPeriodFromConfig();
bool IsHourly();
BalanceOverviewFilterDto GetFiltersFromConfig();
}
class AppSettingsReader : IAppSettingsReader
{
public GasPeriodDto GetGasPeriodFromConfig()