Ver código fonte

2001-11-14 Miguel de Icaza <[email protected]>

	* Decimal.cs, Double.cs, Byte.cs, Char.cs, Int16, UInt16, Int32,
	UInt32, Int64, UInt64, SByte, Single (CompareTo): Throw the
	exception if the value is null too.

	* Char.cs (CompareTo): ditto.

	* ApplicationException.cs: Added constructor that does serialization.

	* ParamArrayAttribute.cs: Define attribute correctly.

svn path=/trunk/mcs/; revision=1354
Miguel de Icaza 24 anos atrás
pai
commit
02b414cf9c

+ 11 - 4
mcs/class/corlib/System/AppDomain.cs

@@ -14,20 +14,27 @@ using System.Reflection.Emit;
 using System.Runtime.CompilerServices;
 
 namespace System {
+
 	public interface AppDomain_Intf {
 	}
+
 	public sealed class AppDomain /* : MarshalByRefObject , _AppDomain, IEvidenceFactory */ {
 
 		[MethodImplAttribute(MethodImplOptions.InternalCall)]
 		private static extern AppDomain getCurDomain ();
 		
-		public static AppDomain CurrentDomain {
-			get { return getCurDomain ();}
+		public static AppDomain CurrentDomain
+		{
+			get {
+				return getCurDomain ();
+			}
 		}
-		public AssemblyBuilder DefineDynamicAssembly( AssemblyName name, AssemblyBuilderAccess access) {
+
+		public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+							      AssemblyBuilderAccess access)
+		{
 			AssemblyBuilder ab = new AssemblyBuilder (name, access);
 			return ab;
 		}
-
 	}
 }

+ 10 - 1
mcs/class/corlib/System/ApplicationException.cs

@@ -1,12 +1,16 @@
 //
 // System.ApplicationException.cs
 //
-// Author:
+// Authors:
 //   Joe Shaw ([email protected])
+//   Miguel de Icaza ([email protected]) 
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
+using System.Runtime.Serialization;
+using System.Reflection;
+
 namespace System {
 
 	public class ApplicationException : Exception {
@@ -25,5 +29,10 @@ namespace System {
 			: base (message, inner)
 		{
 		}
+
+		protected ApplicationException (SerializationInfo info, StreamingContext context)
+			: base (info, context)
+		{
+		}
 	}
 }

+ 1 - 1
mcs/class/corlib/System/Byte.cs

@@ -23,7 +23,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.Byte))
+			if (v == null || !(v is System.Byte))
 				throw new ArgumentException ("Value is not a System.Byte");
 
 			return value - ((byte) v);

+ 11 - 0
mcs/class/corlib/System/ChangeLog

@@ -1,3 +1,14 @@
+2001-11-14  Miguel de Icaza  <[email protected]>
+
+	* Decimal.cs, Double.cs, Byte.cs, Char.cs, Int16, UInt16, Int32,
+	UInt32, Int64, UInt64, SByte, Single (CompareTo): Throw the
+	exception if the value is null too.
+
+	* Char.cs (CompareTo): ditto.
+
+	* ApplicationException.cs: Added constructor that does serialization.
+
+	* ParamArrayAttribute.cs: Define attribute correctly.
 
 Wed Nov 14 16:31:19 CET 2001 Paolo Molaro <[email protected]>
 

+ 1 - 1
mcs/class/corlib/System/Char.cs

@@ -28,7 +28,7 @@ namespace System {
 		
 		public int CompareTo (object v)
 		{
-			if (!(v is System.Char))
+			if (v == null || !(v is System.Char))
 				throw new ArgumentException ("Value is not a System.Char");
 
 			return value - ((char) v);

+ 1 - 1
mcs/class/corlib/System/Decimal.cs

@@ -588,7 +588,7 @@ namespace System
 
         public int CompareTo(object val)
         {
-            if (!(val is Decimal))
+            if (val == null || !(val is Decimal))
                 throw new ArgumentException ("Value is not a System.Decimal");
 
             Decimal d2 = (Decimal)val;

+ 1 - 1
mcs/class/corlib/System/Double.cs

@@ -25,7 +25,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.Double))
+			if (v == null || !(v is System.Double))
 				throw new ArgumentException ("Value is not a System.Double");
 
 			return (int) (value - ((double) v));

+ 1 - 1
mcs/class/corlib/System/Int16.cs

@@ -23,7 +23,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.Int16))
+			if (v == null || !(v is System.Int16))
 				throw new ArgumentException ("Value is not a System.Int16");
 
 			return value - ((short) v);

+ 1 - 1
mcs/class/corlib/System/Int32.cs

@@ -21,7 +21,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.Int32))
+			if (v == null || !(v is System.Int32))
 				throw new ArgumentException ("Value is not a System.Int32");
 
 			return value - (int) v;

+ 1 - 1
mcs/class/corlib/System/Int64.cs

@@ -21,7 +21,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.Int64))
+			if (v == null || !(v is System.Int64))
 				throw new ArgumentException ("Value is not a System.Int64");
 
 			if (value == (long) v)

+ 6 - 1
mcs/class/corlib/System/ParamArrayAttribute.cs

@@ -9,7 +9,12 @@
 
 namespace System {
 
-	public abstract class ParamArrayAttribute {
+	/// <summary>
+	///   Used to flag that the method will take a variable number
+	///   of arguments
+	/// </summary>
+	[AttributeUsage(AttributeTargets.Parameter)]
+	public sealed class ParamArrayAttribute : Attribute {
 
 		public ParamArrayAttribute ()
 		{

+ 1 - 1
mcs/class/corlib/System/SByte.cs

@@ -24,7 +24,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.SByte))
+			if (v == null || !(v is System.SByte))
 				throw new ArgumentException ("Value is not a System.SByte");
 
 			return value - ((sbyte) v);

+ 1 - 1
mcs/class/corlib/System/Single.cs

@@ -25,7 +25,7 @@ namespace System {
 	       		
 		public int CompareTo (object v)
 		{
-			if (!(v is System.Single))
+			if (v == null || !(v is System.Single))
 				throw new ArgumentException ("Value is not a System.Single");
 
 			return (int) (value - ((float) v));

+ 1 - 1
mcs/class/corlib/System/UInt16.cs

@@ -22,7 +22,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.UInt16))
+			if (v == null || !(v is System.UInt16))
 				throw new ArgumentException ("Value is not a System.UInt16");
 
 			return value - ((ushort) v);

+ 1 - 1
mcs/class/corlib/System/UInt32.cs

@@ -22,7 +22,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.UInt32))
+			if (v == null || !(v is System.UInt32))
 				throw new ArgumentException ("Value is not a System.UInt32");
 
 			if (value == (uint) v)

+ 1 - 1
mcs/class/corlib/System/UInt64.cs

@@ -22,7 +22,7 @@ namespace System {
 
 		public int CompareTo (object v)
 		{
-			if (!(v is System.UInt64))
+			if (v == null || !(v is System.UInt64))
 				throw new ArgumentException ("Value is not a System.UInt64");
 
 			if (value == (ulong) v)