From 8dfe6d5082ed5ca4bd9b270dd58a714beb100b01 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Tue, 29 Nov 2022 17:26:03 +0000 Subject: [PATCH] Fix CS8600 and CS8602 --- X10D/src/Drawing/Polygon.cs | 6 ++++-- X10D/src/Drawing/PolygonF.cs | 4 +++- X10D/src/Drawing/Polyhedron.cs | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/X10D/src/Drawing/Polygon.cs b/X10D/src/Drawing/Polygon.cs index 87c29bf..f6564ad 100644 --- a/X10D/src/Drawing/Polygon.cs +++ b/X10D/src/Drawing/Polygon.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; namespace X10D.Drawing; @@ -128,7 +129,7 @@ public class Polygon : IEquatable /// if and are considered not equal; otherwise, /// . /// - public static bool operator !=(Polygon left, Polygon right) + public static bool operator !=(Polygon? left, Polygon? right) { return !(left == right); } @@ -138,6 +139,7 @@ public class Polygon : IEquatable /// /// The polygon to convert. /// The converted polygon. + [return: NotNullIfNotNull("polygon")] public static explicit operator Polygon?(PolygonF? polygon) { return polygon is null ? null : FromPolygonF(polygon); diff --git a/X10D/src/Drawing/PolygonF.cs b/X10D/src/Drawing/PolygonF.cs index 13d7813..560f984 100644 --- a/X10D/src/Drawing/PolygonF.cs +++ b/X10D/src/Drawing/PolygonF.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; using System.Numerics; using X10D.Numerics; @@ -169,6 +170,7 @@ public class PolygonF /// /// The polygon to convert. /// The converted polygon. + [return: NotNullIfNotNull("polygon")] public static implicit operator PolygonF?(Polygon? polygon) { return polygon is null ? null : FromPolygon(polygon); diff --git a/X10D/src/Drawing/Polyhedron.cs b/X10D/src/Drawing/Polyhedron.cs index 79a27cc..15538fb 100644 --- a/X10D/src/Drawing/Polyhedron.cs +++ b/X10D/src/Drawing/Polyhedron.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; using System.Numerics; namespace X10D.Drawing; @@ -140,6 +141,7 @@ public class Polyhedron : IEquatable /// /// The converted polyhedron, or if is . /// + [return: NotNullIfNotNull("polygon")] public static implicit operator Polyhedron?(Polygon? polygon) { return polygon is null ? null : FromPolygon(polygon); @@ -152,6 +154,7 @@ public class Polyhedron : IEquatable /// /// The converted polyhedron, or if is . /// + [return: NotNullIfNotNull("polygon")] public static implicit operator Polyhedron?(PolygonF? polygon) { return polygon is null ? null : FromPolygonF(polygon);