diff options
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Int32.cs')
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Int32.cs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Int32.cs b/src/System.Private.CoreLib/shared/System/Int32.cs index b573e950e..1d0aefe73 100644 --- a/src/System.Private.CoreLib/shared/System/Int32.cs +++ b/src/System.Private.CoreLib/shared/System/Int32.cs @@ -12,9 +12,9 @@ namespace System [Serializable] [StructLayout(LayoutKind.Sequential)] [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - public struct Int32 : IComparable, IConvertible, IFormattable, IComparable<Int32>, IEquatable<Int32>, ISpanFormattable + public readonly struct Int32 : IComparable, IConvertible, IFormattable, IComparable<int>, IEquatable<int>, ISpanFormattable { - private int m_value; // Do not rename (binary serialization) + private readonly int m_value; // Do not rename (binary serialization) public const int MaxValue = 0x7fffffff; public const int MinValue = unchecked((int)0x80000000); @@ -28,13 +28,13 @@ namespace System // null is considered to be less than any instance, hence returns positive number // If object is not of type Int32, this method throws an ArgumentException. // - public int CompareTo(Object value) + public int CompareTo(object value) { if (value == null) { return 1; } - if (value is Int32) + if (value is int) { // NOTE: Cannot use return (_value - value) as this causes a wrap // around in cases where _value - value > MaxValue. @@ -55,17 +55,17 @@ namespace System return 0; } - public override bool Equals(Object obj) + public override bool Equals(object obj) { - if (!(obj is Int32)) + if (!(obj is int)) { return false; } - return m_value == ((Int32)obj).m_value; + return m_value == ((int)obj).m_value; } [NonVersionable] - public bool Equals(Int32 obj) + public bool Equals(int obj) { return m_value == obj; } @@ -76,22 +76,22 @@ namespace System return m_value; } - public override String ToString() + public override string ToString() { return Number.FormatInt32(m_value, null, null); } - public String ToString(String format) + public string ToString(string format) { return Number.FormatInt32(m_value, format, null); } - public String ToString(IFormatProvider provider) + public string ToString(IFormatProvider provider) { return Number.FormatInt32(m_value, null, provider); } - public String ToString(String format, IFormatProvider provider) + public string ToString(string format, IFormatProvider provider) { return Number.FormatInt32(m_value, format, provider); } @@ -101,13 +101,13 @@ namespace System return Number.TryFormatInt32(m_value, format, provider, destination, out charsWritten); } - public static int Parse(String s) + public static int Parse(string s) { if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); return Number.ParseInt32(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo); } - public static int Parse(String s, NumberStyles style) + public static int Parse(string s, NumberStyles style) { NumberFormatInfo.ValidateParseStyleInteger(style); if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); @@ -118,7 +118,7 @@ namespace System // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. // - public static int Parse(String s, IFormatProvider provider) + public static int Parse(string s, IFormatProvider provider) { if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); return Number.ParseInt32(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider)); @@ -128,7 +128,7 @@ namespace System // a NumberFormatInfo isn't specified, the current culture's // NumberFormatInfo is assumed. // - public static int Parse(String s, NumberStyles style, IFormatProvider provider) + public static int Parse(string s, NumberStyles style, IFormatProvider provider) { NumberFormatInfo.ValidateParseStyleInteger(style); if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s); @@ -144,7 +144,7 @@ namespace System // Parses an integer from a String. Returns false rather // than throwing exceptin if input is invalid // - public static bool TryParse(String s, out Int32 result) + public static bool TryParse(string s, out int result) { if (s == null) { @@ -163,7 +163,7 @@ namespace System // Parses an integer from a String in the given style. Returns false rather // than throwing exceptin if input is invalid // - public static bool TryParse(String s, NumberStyles style, IFormatProvider provider, out Int32 result) + public static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out int result) { NumberFormatInfo.ValidateParseStyleInteger(style); @@ -251,7 +251,7 @@ namespace System return Convert.ToDouble(m_value); } - Decimal IConvertible.ToDecimal(IFormatProvider provider) + decimal IConvertible.ToDecimal(IFormatProvider provider) { return Convert.ToDecimal(m_value); } @@ -261,7 +261,7 @@ namespace System throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int32", "DateTime")); } - Object IConvertible.ToType(Type type, IFormatProvider provider) + object IConvertible.ToType(Type type, IFormatProvider provider) { return Convert.DefaultToType((IConvertible)this, type, provider); } |