Skip to content

Instantly share code, notes, and snippets.

@tomspilman
Created January 20, 2018 17:31
Show Gist options
  • Save tomspilman/4a28e35b8bd1ac1a97975c09a6afe508 to your computer and use it in GitHub Desktop.
Save tomspilman/4a28e35b8bd1ac1a97975c09a6afe508 to your computer and use it in GitHub Desktop.
private static bool ranActionStatic;
struct StaticsForAction
{
private static readonly List<int> _integers = new List<int>();
static StaticsForAction()
{
ranActionStatic = true;
}
public static void InitializeIntegerStuff()
{
Assert.True(_integers != null);
Assert.True(_integers.Count == 0);
_integers.Add(1);
}
}
public static void Actions()
{
Assert.False(ranActionStatic);
var a = new Action(StaticsForAction.InitializeIntegerStuff);
Assert.True(ranActionStatic);
a.Invoke();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment