Email Address RegEx
For this I just wanted a basic regex for email addresses, it will get nearly all emails but there’s likely to be some edge cases that it’s unhappy with.
For this I just wanted a basic regex for email addresses, it will get nearly all emails but there’s likely to be some edge cases that it’s unhappy with.
I use Serilog to log to a SQL database in most of my web applications and although it’s pretty well documented the details relevant to my projects are spread out over a few sites so I figured I’d gather them here together for future reference. Packages Install these packages from Read more…
Importing CSV files into a .NET object isn’t too tricky and for this I usually use CsvHelper. However, sometimes I need to import a CSV file and only extract a couple of columns from it and these columns aren’t always guaranteed to exist. In order to do this I use Read more…
If you want to check if one instance of a custom class is equal to another instance of it you need to override the Equals operator for the class and implement your own. The code below is based on the articles The Right Way to do Equality in C# and Read more…
Sometimes in an MVC controller you just want to return a HTTP status code from a method rather than a view or data object. This is pretty simple but is done slightly differently in .NET Core than it was done previously. Some of the more common status codes such as Read more…
I’ve been working to create a virtual file system for SQL databases and represent this in a web interface. While creating the classes in .NET I realised that I needed to be able to traverse all the ancestors of a file up to the root level and to flatten these Read more…
I’ve previously used “Individual User Accounts” authentication for authenticating users in web applications but as the management of users in the underlying SQL databases isn’t that simple it seemed that using Azure Active Directory to manage users might be a better option. The first step in the process is to Read more…
I’ve gotten so used to working with JSON that I’d almost forgotten what a chore it can be to work with XML. A case in point is the below XML sample that I’m trying to deserialize into a class, essentially I want to capture all the attributes of the “Attribute” Read more…
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 separated by a semicolon. Strangely this only sends to the first email in the string so Read more…
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.