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

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

DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)

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 way to support my work is to like / comment / share for the algorithm and subscribe for future updates.