diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-09-04 18:21:59 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-09-05 11:46:55 +0300 |
commit | ff7dd88cfaffa7fa430fd3e0e98f4662d0f7dc59 (patch) | |
tree | f052ce1235ced9d0abd9dde513c7bdf6e6682302 /netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs | |
parent | db626fe9d370fb1f431667ae31a370b70275ef2b (diff) |
Use expression-bodied members in more places (dotnet/coreclr#26500)
* Fix IDE0027 (use expression body for accessors)
* Fix IDE0023 / IDE0024 (use expression body for operators)
* Apply suggestions from code review
Co-Authored-By: Adam Sitnik <adam.sitnik@gmail.com>
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Diffstat (limited to 'netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs')
-rw-r--r-- | netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs b/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs index 091513ad001..42fd9177af9 100644 --- a/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs +++ b/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs @@ -828,55 +828,35 @@ namespace System // Operators - public static implicit operator DateTimeOffset(DateTime dateTime) - { - return new DateTimeOffset(dateTime); - } + public static implicit operator DateTimeOffset(DateTime dateTime) => + new DateTimeOffset(dateTime); - public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) - { - return new DateTimeOffset(dateTimeOffset.ClockDateTime + timeSpan, dateTimeOffset.Offset); - } + public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) => + new DateTimeOffset(dateTimeOffset.ClockDateTime + timeSpan, dateTimeOffset.Offset); - public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) - { - return new DateTimeOffset(dateTimeOffset.ClockDateTime - timeSpan, dateTimeOffset.Offset); - } + public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) => + new DateTimeOffset(dateTimeOffset.ClockDateTime - timeSpan, dateTimeOffset.Offset); - public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right) - { - return left.UtcDateTime - right.UtcDateTime; - } + public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right) => + left.UtcDateTime - right.UtcDateTime; - public static bool operator ==(DateTimeOffset left, DateTimeOffset right) - { - return left.UtcDateTime == right.UtcDateTime; - } + public static bool operator ==(DateTimeOffset left, DateTimeOffset right) => + left.UtcDateTime == right.UtcDateTime; - public static bool operator !=(DateTimeOffset left, DateTimeOffset right) - { - return left.UtcDateTime != right.UtcDateTime; - } + public static bool operator !=(DateTimeOffset left, DateTimeOffset right) => + left.UtcDateTime != right.UtcDateTime; - public static bool operator <(DateTimeOffset left, DateTimeOffset right) - { - return left.UtcDateTime < right.UtcDateTime; - } + public static bool operator <(DateTimeOffset left, DateTimeOffset right) => + left.UtcDateTime < right.UtcDateTime; - public static bool operator <=(DateTimeOffset left, DateTimeOffset right) - { - return left.UtcDateTime <= right.UtcDateTime; - } + public static bool operator <=(DateTimeOffset left, DateTimeOffset right) => + left.UtcDateTime <= right.UtcDateTime; - public static bool operator >(DateTimeOffset left, DateTimeOffset right) - { - return left.UtcDateTime > right.UtcDateTime; - } + public static bool operator >(DateTimeOffset left, DateTimeOffset right) => + left.UtcDateTime > right.UtcDateTime; - public static bool operator >=(DateTimeOffset left, DateTimeOffset right) - { - return left.UtcDateTime >= right.UtcDateTime; - } + public static bool operator >=(DateTimeOffset left, DateTimeOffset right) => + left.UtcDateTime >= right.UtcDateTime; } } |