diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-09-25 17:05:48 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-09-25 21:13:47 +0300 |
commit | c256e409c99ddb5b3618e99ba27af83ea38bfe90 (patch) | |
tree | f511225ae5aba09c07a4101e099adb6380cfa437 /netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs | |
parent | 39ff579432fc6261469f9f0ce6304ca29a5ef141 (diff) |
More Corelib cleanup (dotnet/coreclr#26872)
* Remove unnecessary asserts
* Make several classes static
* Use is instead of as+null check
* Use T? instead of Nullable<T>
* more static classes
* Mark locals as const
* Merge declaration and initialization of some variables
* Remove unnecessary casts
* Remove unnecessary "unsafe"s
* Simplify several lambda expressions
* Remove redundant parentheses
* Remove redundant '== true'
* Remove redundant empty lines
* Simplify boolean comparison with '== false'
* Replace if-statement with return statement
* Use while for infinite loop
* Add static to all partial static class declarations
* Use ++/-- operator instead of assignment
* Use string.IsNullOrEmpty
* Use coalesce expression
* Simplify lazy initialization
* Use coalese expression
* Join string expressions
* Use regular string literal instead of verbatim string literal
* Optimize StringBuilder.Append calls
* Remove redundant assignment
* Remove unnecessary unsafe context
* Merge processor directives
* Use String.Equals instead of String.Compare
* Use Debug.Fail instead of Debug.Assert(false
* Remove Attribute suffix
* Use predefined type
* Use compound assignment
* Use while statement to create an infinite loop
* Remove redundant base ctor call
* Avoid using catch (Exception)
* Remove empty regions
* Span comparison to null
* Avoid unnecessary boxing of value type
* Expression is always equal to 'true'
* Remove unused method
* update coalesce assignment
* fix unsafe
* fix redundant parens
* Fix whitespace errors introduced
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 | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs b/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs index 42fd9177af9..81a06124163 100644 --- a/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs +++ b/netcore/System.Private.CoreLib/shared/System/DateTimeOffset.cs @@ -187,7 +187,6 @@ namespace System public DateTimeOffset ToOffset(TimeSpan offset) => new DateTimeOffset((_dateTime + offset).Ticks, offset); - // Instance Properties // The clock or visible time represented. This is just a wrapper around the internal date because this is @@ -223,7 +222,6 @@ namespace System // public int Hour => ClockDateTime.Hour; - // Returns the millisecond part of this DateTimeOffset. The returned value // is an integer between 0 and 999. // @@ -371,7 +369,6 @@ namespace System return 0; } - // Checks if this DateTimeOffset is equal to a given object. Returns // true if the given object is a boxed DateTimeOffset and its value // is equal to the value of this DateTimeOffset. Returns false @@ -390,7 +387,7 @@ namespace System // currently the Kind should always be Unspecified, but there is always the possibility that a future version // of DateTimeOffset overloads the Kind field // - (ClockDateTime == other.ClockDateTime && Offset == other.Offset && ClockDateTime.Kind == other.ClockDateTime.Kind); + ClockDateTime == other.ClockDateTime && Offset == other.Offset && ClockDateTime.Kind == other.ClockDateTime.Kind; // Compares two DateTimeOffset values for equality. Returns true if // the two DateTimeOffset values are equal, or false if they are @@ -448,7 +445,6 @@ namespace System } } - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) @@ -460,7 +456,6 @@ namespace System info.AddValue("OffsetMinutes", _offsetMinutes); // Do not rename (binary serialization) } - private DateTimeOffset(SerializationInfo info, StreamingContext context) { if (info == null) @@ -586,7 +581,6 @@ namespace System public DateTimeOffset Subtract(TimeSpan value) => new DateTimeOffset(ClockDateTime.Subtract(value), Offset); - public long ToFileTime() => UtcDateTime.ToFileTime(); public long ToUnixTimeSeconds() @@ -834,7 +828,6 @@ namespace System public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) => new DateTimeOffset(dateTimeOffset.ClockDateTime + timeSpan, dateTimeOffset.Offset); - public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) => new DateTimeOffset(dateTimeOffset.ClockDateTime - timeSpan, dateTimeOffset.Offset); |