List Shuffling

List Shuffling This is just a simple extension for lists to enable the shuffling of items within it based on the StackOverflow answer here. This relies on System.Random so isn’t as random as it could be but is fine for my purposes. public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source, Random rng) Read more…

Enum JSON Converter

Enum JSON converter. In addition to the SingleOrArrayEnumConverter mentioned previously I’ve also created a version to translate enums to/from JSON using the name of the enum rather than it’s value as is the default. class EnumConverter<T> : JsonConverter { public override bool CanConvert(Type objectType) { return (objectType == typeof(T)); } Read more…