diff options
Diffstat (limited to 'src/mscorlib/src/System/Decimal.cs')
-rw-r--r-- | src/mscorlib/src/System/Decimal.cs | 60 |
1 files changed, 4 insertions, 56 deletions
diff --git a/src/mscorlib/src/System/Decimal.cs b/src/mscorlib/src/System/Decimal.cs index 8a2c30ffa8..fd16697199 100644 --- a/src/mscorlib/src/System/Decimal.cs +++ b/src/mscorlib/src/System/Decimal.cs @@ -206,13 +206,11 @@ namespace System { // Constructs a Decimal from a float value. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern Decimal(float value); // Constructs a Decimal from a double value. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern Decimal(double value); @@ -264,7 +262,7 @@ namespace System { private void SetBits(int[] bits) { if (bits==null) - throw new ArgumentNullException("bits"); + throw new ArgumentNullException(nameof(bits)); Contract.EndContractBlock(); if (bits.Length == 4) { int f = bits[3]; @@ -283,7 +281,7 @@ namespace System { // public Decimal(int lo, int mid, int hi, bool isNegative, byte scale) { if (scale > 28) - throw new ArgumentOutOfRangeException("scale", Environment.GetResourceString("ArgumentOutOfRange_DecimalScale")); + throw new ArgumentOutOfRangeException(nameof(scale), Environment.GetResourceString("ArgumentOutOfRange_DecimalScale")); Contract.EndContractBlock(); this.lo = lo; this.mid = mid; @@ -335,7 +333,6 @@ namespace System { // Adds two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Add(Decimal d1, Decimal d2) { FCallAddSub (ref d1, ref d2, DECIMAL_ADD); @@ -346,11 +343,9 @@ namespace System { // of the operation. Passing in DECIMAL_ADD or DECIMAL_NEG for bSign indicates // addition or subtraction, respectively. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallAddSub(ref Decimal d1, ref Decimal d2, byte bSign); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallAddSubOverflowed(ref Decimal d1, ref Decimal d2, byte bSign, ref bool overflowed); @@ -363,13 +358,11 @@ namespace System { // Compares two Decimal values, returning an integer that indicates their // relationship. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static int Compare(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2); } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern int FCallCompare(ref Decimal d1, ref Decimal d2); @@ -380,7 +373,6 @@ namespace System { // null is considered to be less than any instance. // If object is not of type Decimal, this method throws an ArgumentException. // - [System.Security.SecuritySafeCritical] // auto-generated public int CompareTo(Object value) { if (value == null) @@ -392,7 +384,6 @@ namespace System { return FCallCompare(ref this, ref other); } - [System.Security.SecuritySafeCritical] // auto-generated public int CompareTo(Decimal value) { return FCallCompare(ref this, ref value); @@ -400,7 +391,6 @@ namespace System { // Divides two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Divide(Decimal d1, Decimal d2) { FCallDivide (ref d1, ref d2); @@ -410,11 +400,9 @@ namespace System { // FCallDivide divides two decimal values. On return, d1 contains the result // of the operation. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallDivide(ref Decimal d1, ref Decimal d2); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallDivideOverflowed(ref Decimal d1, ref Decimal d2, ref bool overflowed); @@ -423,7 +411,6 @@ namespace System { // if the given object is a boxed Decimal and its value is equal to the // value of this Decimal. Returns false otherwise. // - [System.Security.SecuritySafeCritical] // auto-generated public override bool Equals(Object value) { if (value is Decimal) { Decimal other = (Decimal)value; @@ -432,7 +419,6 @@ namespace System { return false; } - [System.Security.SecuritySafeCritical] // auto-generated public bool Equals(Decimal value) { return FCallCompare(ref this, ref value) == 0; @@ -440,14 +426,12 @@ namespace System { // Returns the hash code for this Decimal. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern override int GetHashCode(); // Compares two Decimal values for equality. Returns true if the two // Decimal values are equal, or false if they are not equal. // - [System.Security.SecuritySafeCritical] // auto-generated public static bool Equals(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) == 0; } @@ -455,14 +439,12 @@ namespace System { // Rounds a Decimal to an integer value. The Decimal argument is rounded // towards negative infinity. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Floor(Decimal d) { FCallFloor (ref d); return d; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallFloor(ref Decimal d); @@ -471,25 +453,21 @@ namespace System { // optionally followed by a decimal point (".") and another sequence of // digits. // - [System.Security.SecuritySafeCritical] // auto-generated public override String ToString() { Contract.Ensures(Contract.Result<String>() != null); return Number.FormatDecimal(this, null, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format) { Contract.Ensures(Contract.Result<String>() != null); return Number.FormatDecimal(this, format, NumberFormatInfo.CurrentInfo); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(IFormatProvider provider) { Contract.Ensures(Contract.Result<String>() != null); return Number.FormatDecimal(this, null, NumberFormatInfo.GetInstance(provider)); } - [System.Security.SecuritySafeCritical] // auto-generated public String ToString(String format, IFormatProvider provider) { Contract.Ensures(Contract.Result<String>() != null); return Number.FormatDecimal(this, format, NumberFormatInfo.GetInstance(provider)); @@ -650,7 +628,6 @@ namespace System { // Returns the larger of two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static Decimal Max(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) >= 0? d1: d2; @@ -658,7 +635,6 @@ namespace System { // Returns the smaller of two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] internal static Decimal Min(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) < 0? d1: d2; @@ -709,7 +685,6 @@ namespace System { // Multiplies two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Multiply(Decimal d1, Decimal d2) { FCallMultiply (ref d1, ref d2); @@ -719,11 +694,9 @@ namespace System { // FCallMultiply multiples two decimal values. On return, d1 contains the result // of the operation. // - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallMultiply(ref Decimal d1, ref Decimal d2); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallMultiplyOverflowed(ref Decimal d1, ref Decimal d2, ref bool overflowed); @@ -746,7 +719,6 @@ namespace System { return Round(d, 0); } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Round(Decimal d, int decimals) { FCallRound (ref d, decimals); @@ -757,12 +729,11 @@ namespace System { return Round(d, 0, mode); } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Round(Decimal d, int decimals, MidpointRounding mode) { if ((decimals < 0) || (decimals > 28)) - throw new ArgumentOutOfRangeException("decimals", Environment.GetResourceString("ArgumentOutOfRange_DecimalRound")); + throw new ArgumentOutOfRangeException(nameof(decimals), Environment.GetResourceString("ArgumentOutOfRange_DecimalRound")); if (mode < MidpointRounding.ToEven || mode > MidpointRounding.AwayFromZero) { - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnumValue", mode, "MidpointRounding"), "mode"); + throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnumValue", mode, nameof(MidpointRounding)), nameof(mode)); } Contract.EndContractBlock(); @@ -775,13 +746,11 @@ namespace System { return d; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallRound(ref Decimal d, int decimals); // Subtracts two Decimal values. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Subtract(Decimal d1, Decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_NEG); @@ -843,7 +812,6 @@ namespace System { // has fewer significant digits than a Decimal, this operation may // produce round-off errors. // - [System.Security.SecuritySafeCritical] // auto-generated internal static Currency ToCurrency(Decimal d) { Currency result = new Currency (); @@ -851,18 +819,15 @@ namespace System { return result; } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallToCurrency(ref Currency result, Decimal d); // Converts a Decimal to a double. Since a double has fewer significant // digits than a Decimal, this operation may produce round-off errors. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern double ToDouble(Decimal d); - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int FCallToInt32(Decimal d); @@ -870,7 +835,6 @@ namespace System { // zero to the nearest integer value, and the result of this operation is // returned as an integer. // - [System.Security.SecuritySafeCritical] // auto-generated public static int ToInt32(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); if (d.hi == 0 && d.mid == 0) { @@ -890,7 +854,6 @@ namespace System { // to the nearest integer value, and the result of this operation is // returned as a long. // - [System.Security.SecuritySafeCritical] // auto-generated public static long ToInt64(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); if (d.hi == 0) { @@ -927,7 +890,6 @@ namespace System { // value is rounded towards zero to the nearest integer value, and the // result of this operation is returned as an unsigned integer. // - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public static uint ToUInt32(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); @@ -943,7 +905,6 @@ namespace System { // value is rounded towards zero to the nearest integer value, and the // result of this operation is returned as a long. // - [System.Security.SecuritySafeCritical] // auto-generated [CLSCompliant(false)] public static ulong ToUInt64(Decimal d) { if ((d.flags & ScaleMask) != 0) FCallTruncate (ref d); @@ -958,7 +919,6 @@ namespace System { // Converts a Decimal to a float. Since a float has fewer significant // digits than a Decimal, this operation may produce round-off errors. // - [System.Security.SecuritySafeCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern float ToSingle(Decimal d); @@ -966,7 +926,6 @@ namespace System { // towards zero to the nearest integer value, corresponding to removing all // digits after the decimal point. // - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal Truncate(Decimal d) { FCallTruncate (ref d); @@ -974,7 +933,6 @@ namespace System { } - [System.Security.SecurityCritical] // auto-generated [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void FCallTruncate(ref Decimal d); @@ -1099,25 +1057,21 @@ namespace System { return Subtract(d, One); } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator +(Decimal d1, Decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_ADD); return d1; } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator -(Decimal d1, Decimal d2) { FCallAddSub(ref d1, ref d2, DECIMAL_NEG); return d1; } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator *(Decimal d1, Decimal d2) { FCallMultiply (ref d1, ref d2); return d1; } - [System.Security.SecuritySafeCritical] // auto-generated public static Decimal operator /(Decimal d1, Decimal d2) { FCallDivide (ref d1, ref d2); return d1; @@ -1127,32 +1081,26 @@ namespace System { return Remainder(d1, d2); } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator ==(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) == 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator !=(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) != 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator <(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) < 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator <=(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) <= 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator >(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) > 0; } - [System.Security.SecuritySafeCritical] // auto-generated public static bool operator >=(Decimal d1, Decimal d2) { return FCallCompare(ref d1, ref d2) >= 0; } |