mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make string comparison ordinal, add comment
This commit is contained in:
@@ -162,7 +162,9 @@ namespace SabreTools.DatItems
|
||||
if (GetName() == other?.GetName())
|
||||
return Equals(other) ? 0 : 1;
|
||||
|
||||
return string.Compare(GetName(), other?.GetName());
|
||||
// If `other?.GetName()` is null, Compare will return > 0
|
||||
// If `this.GetName()` is null, Compare will return < 0
|
||||
return string.Compare(GetName(), other?.GetName(), StringComparison.Ordinal);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -548,7 +550,9 @@ namespace SabreTools.DatItems
|
||||
if (GetName() == other?.GetName())
|
||||
return Equals(other) ? 0 : 1;
|
||||
|
||||
return string.Compare(GetName(), other?.GetName());
|
||||
// If `other?.GetName()` is null, Compare will return > 0
|
||||
// If `this.GetName()` is null, Compare will return < 0
|
||||
return string.Compare(GetName(), other?.GetName(), StringComparison.Ordinal);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user