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.
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.
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 name and value. However, some Read more
I’ve had a few projects where I’ve had a large number of asyncronous tasks to execute but haven’t wanted to execute them all at once as this would create too many threads and would result in system degredation. Initially I used something similar to the below to execute all tasks Read more
For this I just wanted a basic regex for phone numbers, it’s all numeric with an optionaly starting “+”.
The easiest way to post data from a view to a controller action is by adding a form and submit button and letting most of the hard stuff happen automatically. Unfortunately this doesn’t really work in cases where data needs to be submitted by a javascript function, in these situations Read more
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 version to return a fully Read more
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.
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. This can then be used to decorate your enum class like so.
I call SQL stored procedures slightly differently in .NET Core to the way I did in .NET framework as I now pass the connection string through as an argument and I need to remember to add the System.Data.SqlClient NuGet package.
I use the WinSCP dll to download files from SFTP sites in SSDT, as shown here, but this approach doesn’t work in .NET Core applications as the WinSCP dll isn’t available as a NuGet package. An alternative to WinSCP is SSH.NET, which amoung other things, has the ability to download Read more