importing messaging-2008 branch to trunk [continued]
[mono.git] / mcs / class / System.Data / System.Data / TypeDataSetGeneratorException.cs
index 4800d876172306bb0654cb2a5882d3554c955fa3..0c08617a385e7dcd4218f606fc585ca8d350ecf7 100644 (file)
@@ -33,22 +33,22 @@ using System.Collections;
 using System.Globalization;
 using System.Runtime.Serialization;
 
-namespace System.Data {
-
+namespace System.Data
+{
        [Serializable]
        public class TypedDataSetGeneratorException : DataException
        {
-
-               ArrayList errorList;
+               readonly ArrayList errorList;
 
                #region Constructors
+
                public TypedDataSetGeneratorException ()
-                       : base (Locale.GetText ("There is a name conflict"))
+                       : base (Locale.GetText ("System error."))
                {
                }
 
                public TypedDataSetGeneratorException (ArrayList list)
-                       : base (Locale.GetText ("There is a name conflict"))
+                       : base (Locale.GetText ("System error."))
                {
                        errorList = list;
                }
@@ -56,31 +56,42 @@ namespace System.Data {
                protected TypedDataSetGeneratorException (SerializationInfo info, StreamingContext context)
                        : base (info, context)
                {
+                       int count = info.GetInt32 ("KEY_ARRAYCOUNT");
+                       errorList = new ArrayList (count);
+
+                       for (int i=0; i < count; i++)
+                               errorList.Add (info.GetString("KEY_ARRAYVALUES" + i));
                }
 
-               #endregion //Constructors       
+#if NET_2_0
+               public TypedDataSetGeneratorException (String error) : base (error)
+               {
+               }
+               
+               public TypedDataSetGeneratorException (String error, Exception inner) 
+                       : base (error, inner)
+               {
+               }
+#endif
+               #endregion //Constructors
 
-               public ArrayList ErrorList
-                {
-                        get 
-                        {
-                                return errorList;
-                        }
-                                           
+               public ArrayList ErrorList {
+                       get { return errorList; }
                }
 
                #region Methods
-                                                                                                    
-                public override void GetObjectData (SerializationInfo si, StreamingContext context)
-                {
-                        if (si == null)
-                                throw new ArgumentNullException ("si");
-                                                                                                    
-                        si.AddValue ("ErrorList", errorList);
-                        base.GetObjectData (si, context);
-                }
-                                                                                                    
-                #endregion // Methods
 
+               public override void GetObjectData (SerializationInfo info, StreamingContext context)
+               {
+                       base.GetObjectData (info, context);
+
+                       int count = (errorList != null) ? ErrorList.Count : 0;
+                       info.AddValue ("KEY_ARRAYCOUNT", count);
+
+                       for (int i=0; i < count; i++)
+                               info.AddValue ("KEY_ARRAYVALUES" + i, ErrorList [i]);
+               }
+
+               #endregion // Methods
        }
 }