mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-14 04:35:41 +00:00
Fix CA1602 violations
This commit is contained in:
parent
398b0c58b1
commit
deb1f2edd8
@ -1,4 +1,4 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace X10D.Drawing;
|
namespace X10D.Drawing;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class Polygon : IEquatable<Polygon>
|
|||||||
/// Initializes a new instance of the <see cref="Polygon" /> class by copying the specified polygon.
|
/// Initializes a new instance of the <see cref="Polygon" /> class by copying the specified polygon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Polygon(Polygon polygon)
|
public Polygon(Polygon polygon)
|
||||||
: this(polygon._vertices)
|
: this(polygon?._vertices ?? throw new ArgumentNullException(nameof(polygon)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,9 +114,9 @@ public class Polygon : IEquatable<Polygon>
|
|||||||
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered equal; otherwise,
|
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool operator ==(Polygon left, Polygon right)
|
public static bool operator ==(Polygon? left, Polygon? right)
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return Equals(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -130,7 +130,7 @@ public class Polygon : IEquatable<Polygon>
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool operator !=(Polygon left, Polygon right)
|
public static bool operator !=(Polygon left, Polygon right)
|
||||||
{
|
{
|
||||||
return !left.Equals(right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -223,9 +223,9 @@ public class Polygon : IEquatable<Polygon>
|
|||||||
/// <see langword="true" /> if this instance and <paramref name="other" /> are considered equal; otherwise,
|
/// <see langword="true" /> if this instance and <paramref name="other" /> are considered equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public bool Equals(Polygon other)
|
public bool Equals(Polygon? other)
|
||||||
{
|
{
|
||||||
return _vertices.SequenceEqual(other._vertices);
|
return other is not null && _vertices.SequenceEqual(other._vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -21,8 +21,9 @@ public class PolygonF
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PolygonF" /> class by copying the specified polygon.
|
/// Initializes a new instance of the <see cref="PolygonF" /> class by copying the specified polygon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="polygon" /> is <see langword="null" />.</exception>
|
||||||
public PolygonF(PolygonF polygon)
|
public PolygonF(PolygonF polygon)
|
||||||
: this(polygon._vertices)
|
: this(polygon?._vertices ?? throw new ArgumentNullException(nameof(polygon)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ public class PolygonF
|
|||||||
/// Initializes a new instance of the <see cref="PolygonF" /> class by constructing it from the specified vertices.
|
/// Initializes a new instance of the <see cref="PolygonF" /> class by constructing it from the specified vertices.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="vertices">An enumerable collection of vertices from which the polygon should be constructed.</param>
|
/// <param name="vertices">An enumerable collection of vertices from which the polygon should be constructed.</param>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="vertices" /> is <see langword="null" />.</exception>
|
||||||
public PolygonF(IEnumerable<Vector2> vertices)
|
public PolygonF(IEnumerable<Vector2> vertices)
|
||||||
: this(vertices.Select(p => p.ToPointF()))
|
: this(vertices.Select(p => p.ToPointF()))
|
||||||
{
|
{
|
||||||
@ -143,9 +145,9 @@ public class PolygonF
|
|||||||
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered equal; otherwise,
|
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool operator ==(PolygonF left, PolygonF right)
|
public static bool operator ==(PolygonF? left, PolygonF? right)
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return Equals(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -157,9 +159,9 @@ public class PolygonF
|
|||||||
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered not equal; otherwise,
|
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered not equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool operator !=(PolygonF left, PolygonF right)
|
public static bool operator !=(PolygonF? left, PolygonF? right)
|
||||||
{
|
{
|
||||||
return !left.Equals(right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -283,9 +285,9 @@ public class PolygonF
|
|||||||
/// <see langword="true" /> if this instance and <paramref name="other" /> are considered equal; otherwise,
|
/// <see langword="true" /> if this instance and <paramref name="other" /> are considered equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public bool Equals(PolygonF other)
|
public bool Equals(PolygonF? other)
|
||||||
{
|
{
|
||||||
return _vertices.SequenceEqual(other._vertices);
|
return other is not null && _vertices.SequenceEqual(other._vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace X10D.Drawing;
|
namespace X10D.Drawing;
|
||||||
@ -20,8 +20,9 @@ public class Polyhedron : IEquatable<Polyhedron>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Polyhedron" /> class by copying the specified polyhedron.
|
/// Initializes a new instance of the <see cref="Polyhedron" /> class by copying the specified polyhedron.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="polyhedron" /> is <see langword="null" />.</exception>
|
||||||
public Polyhedron(Polyhedron polyhedron)
|
public Polyhedron(Polyhedron polyhedron)
|
||||||
: this(polyhedron._vertices)
|
: this(polyhedron?._vertices ?? throw new ArgumentNullException(nameof(polyhedron)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ public class Polyhedron : IEquatable<Polyhedron>
|
|||||||
/// Initializes a new instance of the <see cref="Polyhedron" /> class by constructing it from the specified vertices.
|
/// Initializes a new instance of the <see cref="Polyhedron" /> class by constructing it from the specified vertices.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="vertices">An enumerable collection of vertices from which the polyhedron should be constructed.</param>
|
/// <param name="vertices">An enumerable collection of vertices from which the polyhedron should be constructed.</param>
|
||||||
|
/// <exception cref="ArgumentNullException"><paramref name="vertices" /> is <see langword="null" />.</exception>
|
||||||
public Polyhedron(IEnumerable<Vector3> vertices)
|
public Polyhedron(IEnumerable<Vector3> vertices)
|
||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
@ -112,9 +114,9 @@ public class Polyhedron : IEquatable<Polyhedron>
|
|||||||
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered equal; otherwise,
|
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool operator ==(Polyhedron left, Polyhedron right)
|
public static bool operator ==(Polyhedron? left, Polyhedron? right)
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return Equals(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -126,9 +128,9 @@ public class Polyhedron : IEquatable<Polyhedron>
|
|||||||
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered not equal; otherwise,
|
/// <see langword="true" /> if <paramref name="left" /> and <paramref name="right" /> are considered not equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static bool operator !=(Polyhedron left, Polyhedron right)
|
public static bool operator !=(Polyhedron? left, Polyhedron? right)
|
||||||
{
|
{
|
||||||
return !left.Equals(right);
|
return !(left == right);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -262,9 +264,9 @@ public class Polyhedron : IEquatable<Polyhedron>
|
|||||||
/// <see langword="true" /> if this instance and <paramref name="other" /> are considered equal; otherwise,
|
/// <see langword="true" /> if this instance and <paramref name="other" /> are considered equal; otherwise,
|
||||||
/// <see langword="false" />.
|
/// <see langword="false" />.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public bool Equals(Polyhedron other)
|
public bool Equals(Polyhedron? other)
|
||||||
{
|
{
|
||||||
return _vertices.SequenceEqual(other._vertices);
|
return other is not null && _vertices.SequenceEqual(other._vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
Loading…
Reference in New Issue
Block a user