summaryrefslogtreecommitdiff
path: root/modules/mono/editor
diff options
context:
space:
mode:
authorIgnacio Roldán Etcheverry <neikeq@users.noreply.github.com>2022-08-26 08:33:52 +0200
committerGitHub <noreply@github.com>2022-08-26 08:33:52 +0200
commite8ce36628f93de46c8cddf132f4a3567d288330f (patch)
treed5eff0712a2dc5249ee36f46e906a97907a3bfab /modules/mono/editor
parent961a5c642ea8cdc522eb11b7e9a03534b05b1f47 (diff)
parenta0da258401c665d773b5247945c17472fca42b43 (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.cs5
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs16
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()