Author: spouliot
Date: 2005-12-19 10:56:10 -0500 (Mon, 19 Dec 2005)
New Revision: 54606

Modified:
   trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
   trunk/mcs/class/corlib/System.Collections.Generic/List.cs
Log:
2005-12-19  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * List.cs: Fix exception reporting to match MS behaviour (2.0 final).



Modified: trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-12-19 
15:55:19 UTC (rev 54605)
+++ trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-12-19 
15:56:10 UTC (rev 54606)
@@ -1,3 +1,7 @@
+2005-12-19  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * List.cs: Fix exception reporting to match MS behaviour (2.0 final).
+
 2005-11-19  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * KeyNotFoundException.cs: Add default message.

Modified: trunk/mcs/class/corlib/System.Collections.Generic/List.cs
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/List.cs   2005-12-19 
15:55:19 UTC (rev 54605)
+++ trunk/mcs/class/corlib/System.Collections.Generic/List.cs   2005-12-19 
15:56:10 UTC (rev 54606)
@@ -7,12 +7,7 @@
 //    Carlos Alberto Cortez ([EMAIL PROTECTED])
 //    David Waite ([EMAIL PROTECTED])
 //
-// (C) 2004 Novell, Inc.
-// (C) 2005 David Waite
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 // Copyright (C) 2005 David Waite
 //
 // Permission is hereby granted, free of charge, to any person obtaining
@@ -36,8 +31,7 @@
 //
 
 #if NET_2_0
-using System;
-using System.Collections;
+
 using System.Collections.ObjectModel;
 using System.Runtime.InteropServices;
 
@@ -324,7 +318,15 @@
                
                public int IndexOf (T item, int index, int count)
                {
-                       CheckRange (index, count);
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("index");
+                       
+                       if (count < 0)
+                               throw new ArgumentOutOfRangeException ("count");
+
+                       if ((uint) index + (uint) count > (uint) size)
+                               throw new ArgumentOutOfRangeException ("index 
and count exceed length of list");
+
                        return Array.IndexOf (data, item, index, count);
                }
                

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to