C#: The type or namespace name 'StringContent' could not be found

Date: 2020-12-20 | csharp | dotnet-core | stringcontent |

Overview

I'm building a web app in C# on .NET Core and I'm running into an issue when trying to use StringContent. The error:

error CS0246: The type or namespace name 'StringContent' could not be found

Solution

Typically errors like this mean you're missing an import. I was able to fix this by adding this import to the top of my file:

using System.Net.Http;

Want more like this?

The best / easiest way to support my work is by subscribing for future updates and sharing with your network.