Skip to content

Instantly share code, notes, and snippets.

@thomaslevesque
Created July 28, 2013 22:05
Show Gist options
  • Save thomaslevesque/6100447 to your computer and use it in GitHub Desktop.
Save thomaslevesque/6100447 to your computer and use it in GitHub Desktop.
Proof that enum types are mutable
var field = typeof(DayOfWeek).GetField("value__");
var d = DayOfWeek.Monday;
Console.WriteLine (d);
TypedReference r = __makeref(d);
field.SetValueDirect(r, 4);
Console.WriteLine (d);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment