Sometimes, when you create DTOs to deserialize json
, you decorate properties with the [JsonRequiredAttribute]
:
class Car
{
[JsonRequired]
public string Make { get; set; }
}
However, when you do this while using ReSharper or C# 8 you'll see the following warning:
Car.cs(30, 19): [CS8618] Non-nullable property 'Make' is uninitialized. Consider declaring the property as nullable.
In some projects I have a lot of such warnings and I was wondering if there is a way to suppress them only for false-positives? I could disable them completely but I'd rather not to.