From 13dc5032526bc06c0efc8afc00c5bfe80f1d6e63 Mon Sep 17 00:00:00 2001 From: philstopford Date: Sun, 11 Sep 2022 08:50:16 -0400 Subject: [PATCH] Make struct read-only (#220) Also address warning about Equals override not matching nullability. --- CSharp/Clipper2Lib/Clipper.Engine.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CSharp/Clipper2Lib/Clipper.Engine.cs b/CSharp/Clipper2Lib/Clipper.Engine.cs index 7a2cadc3..b4c28ca4 100644 --- a/CSharp/Clipper2Lib/Clipper.Engine.cs +++ b/CSharp/Clipper2Lib/Clipper.Engine.cs @@ -62,7 +62,7 @@ public Vertex(Point64 pt, VertexFlags flags, Vertex? prev) } }; - internal struct LocalMinima + internal readonly struct LocalMinima { public readonly Vertex vertex; public readonly PathType polytype; @@ -85,7 +85,7 @@ public LocalMinima(Vertex vertex, PathType polytype, bool isOpen = false) return !(lm1 == lm2); } - public override bool Equals(object obj) + public override bool Equals(object? obj) { return obj is LocalMinima minima && this == minima; }