mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
AbsolutePath implements IEquatable
Equals(object) simplification
This commit is contained in:
parent
0550dd751c
commit
f66c59151b
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@ -24,33 +24,18 @@ namespace Wabbajack.Common
|
||||
public RelativePath FileName { get; }
|
||||
}
|
||||
|
||||
public struct AbsolutePath : IPath, IComparable<AbsolutePath>
|
||||
public struct AbsolutePath : IPath, IComparable<AbsolutePath>, IEquatable<AbsolutePath>
|
||||
{
|
||||
#region ObjectEquality
|
||||
|
||||
private bool Equals(AbsolutePath other)
|
||||
public bool Equals(AbsolutePath other)
|
||||
{
|
||||
return _path == other._path;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ReferenceEquals(this, obj))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (obj.GetType() != GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Equals((AbsolutePath)obj);
|
||||
return obj is AbsolutePath other && Equals(other);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user