Author: lynndemarest
Warning! In C#, X + 1 does Not Necessarily Equal X + 1
In C#, when you add 1 to the largest value an Int32 can hold, you don’t get an error, you get a wrong answer. Below, we set max to the largest Int32 value possible....
Using .Net Core User Secrets to Hold Confidential Data
When programming most applications, there are some configuration items you’d rather not share with the world, for example when you push the repository to github. For example, a secret APIKey needed to access an...
Generic Class makes .NET Core HttpClient Calls (New!)
Note: This is an enhancement of the static HTTPClientHelper class introduced here. Here’s a new and improved class that abstracts HttpClient calls. You add the class to your dependency injection container and then just...
Using Swagger to Document your API in .Net Core 3.1
Swagger, a service you can inject into the middleware pipeline, automatically creates web pages that document your API and allow you to exercise its public elements. To add it to your API, do the...
Securing a REST API with a Secret and an Action Filter
A simple way to secure a private REST API is to insist that all incoming requests include a secret key in the HTTP header. This is surprisingly easy to do using a .Net Core...
Generic Class makes .NET Core HttpClient Calls
Note: This class has been updated. Here’s a generic class that abstracts async HttpClient calls in .NET Core. It can be used, for example, to make calls from a desktop application or web site...
How to Reference Class Properties with Strings Using ASP.NET Reflection
I often want to get (and less frequently set) the value of a class property using a string containing the property name rather than a standard dot reference. So instead of this: I want...
About Me
ASP.NET Developer, Writer, Chess Enthusiast I am an experienced developer using Microsoft and open source technologies, including: Languages : C#, javascript, CSS, HTML, Razor, WPF, XAML, VB Frameworks: .NET, .Net Core, Classic ASP, Angular, MVC, Razor,...