diff options
author | Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com> | 2022-08-26 08:33:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-26 08:33:52 +0200 |
commit | e8ce36628f93de46c8cddf132f4a3567d288330f (patch) | |
tree | d5eff0712a2dc5249ee36f46e906a97907a3bfab /modules/mono/editor | |
parent | 961a5c642ea8cdc522eb11b7e9a03534b05b1f47 (diff) | |
parent | a0da258401c665d773b5247945c17472fca42b43 (diff) |
Merge pull request #64901 from raulsntos/dotnet/equals
C#: Use pattern matching to simplify `Equals`
Diffstat (limited to 'modules/mono/editor')
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools.IdeMessaging/GodotIdeMetadata.cs | 5 | ||||
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs | 16 |
2 files changed, 8 insertions, 13 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/GodotIdeMetadata.cs b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/GodotIdeMetadata.cs index 686202e81e..2448a2953b 100644 --- a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/GodotIdeMetadata.cs +++ b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging/GodotIdeMetadata.cs @@ -25,10 +25,7 @@ namespace GodotTools.IdeMessaging public override bool Equals(object obj) { - if (obj is GodotIdeMetadata metadata) - return metadata == this; - - return false; + return obj is GodotIdeMetadata metadata && metadata == this; } public bool Equals(GodotIdeMetadata other) diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs index 3c5b897719..edbf53a389 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs @@ -27,15 +27,13 @@ namespace GodotTools.Build public override bool Equals(object? obj) { - if (obj is BuildInfo other) - return other.Solution == Solution && - other.Configuration == Configuration && other.RuntimeIdentifier == RuntimeIdentifier && - other.PublishOutputDir == PublishOutputDir && other.Restore == Restore && - other.Rebuild == Rebuild && other.OnlyClean == OnlyClean && - other.CustomProperties == CustomProperties && - other.LogsDirPath == LogsDirPath; - - return false; + return obj is BuildInfo other && + other.Solution == Solution && + other.Configuration == Configuration && other.RuntimeIdentifier == RuntimeIdentifier && + other.PublishOutputDir == PublishOutputDir && other.Restore == Restore && + other.Rebuild == Rebuild && other.OnlyClean == OnlyClean && + other.CustomProperties == CustomProperties && + other.LogsDirPath == LogsDirPath; } public override int GetHashCode() |