@@ -35,43 +35,22 @@ public void SetIcon(bool isPrivate, bool isFork)
3535
3636 public override int GetHashCode ( )
3737 {
38- return ( Name == null ? 0 : Name . GetHashCode ( ) ) ^ ( CloneUrl == null ? 0 : CloneUrl . GetHashCode ( ) ) ^ ( LocalPath == null ? 0 : LocalPath . TrimEnd ( '\\ ' ) . ToUpperInvariant ( ) . GetHashCode ( ) ) ;
38+ return Name ? . GetHashCode ( ) ?? 0 ^ CloneUrl ? . GetHashCode ( ) ?? 0 ^ LocalPath ? . TrimEnd ( '\\ ' ) . ToUpperInvariant ( ) . GetHashCode ( ) ?? 0 ;
3939 }
4040
41- /// <summary>
42- /// This equality comparison will check if the references are the same,
43- /// and if they're not, it will explicitely check if the contents of this
44- /// object are the same. If you only want reference checking, call
45- /// ReferenceEquals
46- /// </summary>
47- public static bool operator == ( SimpleRepositoryModel lhs , SimpleRepositoryModel rhs )
41+ public override bool Equals ( object obj )
4842 {
49- if ( ReferenceEquals ( lhs , rhs ) )
43+ if ( ReferenceEquals ( this , obj ) )
5044 return true ;
51- if ( ( object ) lhs == null || ( object ) rhs == null )
52- return false ;
53- return String . Equals ( lhs . Name , rhs . Name ) && String . Equals ( lhs . CloneUrl , rhs . CloneUrl ) && String . Equals ( lhs . LocalPath ? . TrimEnd ( '\\ ' ) , rhs . LocalPath ? . TrimEnd ( '\\ ' ) , StringComparison . CurrentCultureIgnoreCase ) ;
54- }
55-
56- /// <summary>
57- /// This equality comparison will check if the references are the same,
58- /// and if they're not, it will explicitely check if the contents of this
59- /// object are the same. If you only want reference checking, call
60- /// ReferenceEquals
61- /// </summary>
62- public static bool operator != ( SimpleRepositoryModel lhs , SimpleRepositoryModel rhs )
63- {
64- return ! ( lhs == rhs ) ;
65- }
66-
67- public override bool Equals ( object other )
68- {
69- return other != null && this == other as SimpleRepositoryModel ;
45+ var other = obj as SimpleRepositoryModel ;
46+ return other != null && String . Equals ( Name , other . Name ) && String . Equals ( CloneUrl , other . CloneUrl ) && String . Equals ( LocalPath ? . TrimEnd ( '\\ ' ) , other . LocalPath ? . TrimEnd ( '\\ ' ) , StringComparison . CurrentCultureIgnoreCase ) ;
7047 }
7148
7249 bool IEquatable < SimpleRepositoryModel > . Equals ( SimpleRepositoryModel other )
7350 {
74- return other != null && this == other ;
51+ if ( ReferenceEquals ( this , other ) )
52+ return true ;
53+ return other != null && String . Equals ( Name , other . Name ) && String . Equals ( CloneUrl , other . CloneUrl ) && String . Equals ( LocalPath ? . TrimEnd ( '\\ ' ) , other . LocalPath ? . TrimEnd ( '\\ ' ) , StringComparison . CurrentCultureIgnoreCase ) ;
7554 }
7655
7756 internal string DebuggerDisplay
0 commit comments