diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-04-11 22:22:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 22:22:30 -0400 |
commit | 5d420c416ea52d7e3fcc15f167b04480b367391a (patch) | |
tree | 91de5434fedf21435b7d432d8220b837482cc72b | |
parent | 50c7773f11815b9d780a1c2b49955e2c5f0d9031 (diff) | |
download | coreclr-5d420c416ea52d7e3fcc15f167b04480b367391a.tar.gz coreclr-5d420c416ea52d7e3fcc15f167b04480b367391a.tar.bz2 coreclr-5d420c416ea52d7e3fcc15f167b04480b367391a.zip |
Update Version annotations to match changes in master (#23917)
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Version.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Version.cs b/src/System.Private.CoreLib/shared/System/Version.cs index c6399ba995..67ddf8597f 100644 --- a/src/System.Private.CoreLib/shared/System/Version.cs +++ b/src/System.Private.CoreLib/shared/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); } } } |