From 77288a0ab560a3e99c4fb769e3634f1d6e918c16 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Tue, 8 Aug 2023 12:47:34 +0100 Subject: [PATCH] feat: add operator== for BlogPost --- OliverBooth/Data/Blog/BlogPost.cs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/OliverBooth/Data/Blog/BlogPost.cs b/OliverBooth/Data/Blog/BlogPost.cs index baa4bda..97f4cbb 100644 --- a/OliverBooth/Data/Blog/BlogPost.cs +++ b/OliverBooth/Data/Blog/BlogPost.cs @@ -1,4 +1,4 @@ -using SmartFormat; +using SmartFormat; namespace OliverBooth.Data.Blog; @@ -91,6 +91,29 @@ public sealed class BlogPost : IEquatable /// The legacy WordPress ID. public int? WordPressId { get; set; } + /// + /// Returns a value indicating whether two instances of are equal. + /// + /// The first instance of to compare. + /// The second instance of to compare. + /// + /// if and are equal; otherwise, + /// . + /// + public static bool operator ==(BlogPost? left, BlogPost? right) => Equals(left, right); + + /// + /// Returns a value indicating whether two instances of are not equal. + /// + /// The first instance of to compare. + /// The second instance of to compare. + /// + /// if and are not equal; otherwise, + /// . + /// + public static bool operator !=(BlogPost? left, BlogPost? right) => !(left == right); + + /// /// Returns a value indicating whether this instance of is equal to another instance. ///