Programming

Reading Lists from appsettings.json

Reading Lists from appsettings.json I’ve been using the SendGrid API for a project and I was trying to be lazy and read multiple email addresses to send to from a single parameter in appsettings.json with the email addresses seperated by a semicolon. Strangely this only sends to the first email Read more…

By Shinigami, ago
Programming

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…

By Shinigami, ago
Programming

Serializing JSON Values Without Quotes

Serializing JSON values without quotes I have a package called ChartJSCore which generates the required JavaScript for creating Chart.js charts in a web application. For the most part the JS for this is essentially JSON so this works by serializing chart objects using Newtonsoft which automatically quotes both the object Read more…

By Shinigami, ago
Programming

Building URIs in .NET Core

Building URIs in .NET Core. Creating URIs with parameters in .NET Core is more complicated than I’d initially expected. As a result I ended up creating my own methods based upon this Stack Overflow answer. To begin with I needed a version to return relative paths I’ve also created a Read more…

By Shinigami, ago
Programming

Select List Enum Tag Helper

Select list enum tag helper. If you want to have a select list in a web page which is based on all the values in an enum then you can use the built in function “Html.GetEnumSelectList” with a tag helper. public enum PushType { Notification, Image, Action } <div class="row"> Read more…

By Shinigami, ago