From 0414ad171efd758ed1c527a07d2b8c77138d0dea Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 11 Apr 2019 22:22:30 -0400 Subject: [PATCH] Update Version annotations to match changes in master (dotnet/coreclr#23917) Commit migrated from https://github.com/dotnet/coreclr/commit/5d420c416ea52d7e3fcc15f167b04480b367391a --- .../System.Private.CoreLib/src/System/Version.cs | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Version.cs b/src/libraries/System.Private.CoreLib/src/System/Version.cs index c6399ba..67ddf85 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Version.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Version.cs @@ -427,32 +427,34 @@ namespace System return !(v1 == v2); } - public static bool operator <(Version v1, Version? v2) + public static bool operator <(Version? v1, Version? v2) { if (v1 is null) - throw new ArgumentNullException(nameof(v1)); + { + return !(v2 is null); + } + return (v1.CompareTo(v2) < 0); } - public static bool operator <=(Version v1, Version? v2) + public static bool operator <=(Version? v1, Version? v2) { if (v1 is null) - throw new ArgumentNullException(nameof(v1)); + { + return true; + } + return (v1.CompareTo(v2) <= 0); } - public static bool operator >(Version v1, Version? v2) + public static bool operator >(Version? v1, Version? v2) { - if (v1 is null) - throw new ArgumentNullException(nameof(v1)); - return (v1.CompareTo(v2) > 0); + return (v2 < v1); } - public static bool operator >=(Version v1, Version? v2) + public static bool operator >=(Version? v1, Version? v2) { - if (v1 is null) - throw new ArgumentNullException(nameof(v1)); - return (v1.CompareTo(v2) >= 0); + return (v2 <= v1); } } } -- 2.7.4