From 4b11dc566a5bbfa1378d6266525c281b028abcc8 Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Fri, 10 Feb 2017 20:35:12 +0900 Subject: Imported Upstream version 1.0.0.9910 --- src/mscorlib/src/System/DateTime.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/mscorlib/src/System/DateTime.cs') diff --git a/src/mscorlib/src/System/DateTime.cs b/src/mscorlib/src/System/DateTime.cs index e93346c42f..3de50336a9 100644 --- a/src/mscorlib/src/System/DateTime.cs +++ b/src/mscorlib/src/System/DateTime.cs @@ -13,7 +13,6 @@ namespace System { using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; - using System.Security.Permissions; using System.Diagnostics.Contracts; using CultureInfo = System.Globalization.CultureInfo; using Calendar = System.Globalization.Calendar; @@ -461,7 +460,12 @@ namespace System { // parts of the result are the same as those of this DateTime. // public DateTime AddYears(int value) { - if (value < -10000 || value > 10000) throw new ArgumentOutOfRangeException("years", Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadYears")); + if (value < -10000 || value > 10000) + { + // DateTimeOffset.AddYears(int years) is implemented on top of DateTime.AddYears(int value). Use the more appropriate + // parameter name out of the two for the exception. + throw new ArgumentOutOfRangeException("years", Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadYears")); + } Contract.EndContractBlock(); return AddMonths(value * 12); } @@ -658,7 +662,6 @@ namespace System { return new DateTime(DoubleDateToTicks(d), DateTimeKind.Unspecified); } - [System.Security.SecurityCritical /*auto-generated_required*/] void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException(nameof(info)); @@ -705,12 +708,6 @@ namespace System { return (Int64)dateData; } } - - // Return the underlying data, without adjust local times to the right time zone. Needed if performance - // or compatibility are important. - internal Int64 ToBinaryRaw() { - return (Int64)dateData; - } // Returns the date part of this DateTime. The resulting value // corresponds to this DateTime with the time-of-day part set to -- cgit v1.2.3