Contents tagged with c#
-
Converting a simple solution/project to .NET Core
I have a very small project I started writing back in 2015 for parsing responses from DNS servers, more because I was interested in how to do so than any real need. Because this mostly pre-dates . …
-
A custom model binder for XML content that produces IEnumerable<T>'s
In a previous post (A custom model binder for XML content) I showed code for a custom MVC Model Binder that takes an XML filled string passed to an action and transforms it to an XDocument. The …
-
Link Dump
I haven't had cause to drop one of these since November last year, probably at least in part because Edge seems to have a nasty habit of eating tabs! In no particular order, and likely of more use to …
-
Stopping and starting a System.Timers.Timer - be careful you don't stop forever!
I've sometimes seen code that stops and starts a timer during its TimerElapsed event in order to ensure that the event isn't called whilst it's still being executed from a previous call. If this …
-
Using the CommandLineParser NuGet package to handle your command line
From time to time I've needed to write small console apps that accept parameters via the command line. Luckily, parsing the command line is a solved problem and there are multiple libraries out …
-
Does one string contain another, irrespective of case?
One of the methods that's noticeable by its absence from the .NET Framework / .NET Core (or, to put it another way .NET Standard 2.0) is an override of string.Contains that takes a StringComparison …
-
A basic MSMQ backed WCF server and client
After my recent post, MSMQ messages ending up in the "Transactional dead-letter messages" System Queue, I decided to build up my understanding of how MSMQ backed WCF services work by putting together …
-
MSMQ messages ending up in the "Transactional dead-letter messages" System Queue
I've been working with a solution recently that uses MSMQ to, well, pass messages between components running on different machines. It's been implemented using WCF as the abstraction layer, so …
-
Using is instead of == to check whether an object is a null reference
A tweet yesterday by Bertrand Le Roy:
Something in C# I learned today: `if (a is null)` is not just prettier, it's also more robust than `if (a == null)`. thx @MadsTorgersen
— Bertrand Le Roy (@ …
-
The simplest ASP.NET Core app that'll serve static content
NOTE: This post is targeting .NET Core / ASP.NET Core 2.0, not 1.x
I have a confession to make, I've not spent much time or energy looking into the ins and outs of .NET Core, ASP.NET Core, Entity …