Browse Source

* ParameterModifier.cs: marked serializable, renamed field to match
MS.NET, throw ArgumentException when parameter count is less than or
equal to zero

svn path=/trunk/mcs/; revision=29796

Gert Driesen 21 năm trước cách đây
mục cha
commit
44629757bd

+ 6 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,9 @@
+2004-06-17  Gert Driesen <[email protected]>
+	
+	* ParameterModifier.cs: marked serializable, renamed field to match
+	MS.NET, throw ArgumentException when parameter count is less than or
+	equal to zero
+
 2004-06-15  Gert Driesen <[email protected]>
 
 	* AssemblyName.cs: added TODO for serialization

+ 9 - 5
mcs/class/corlib/System.Reflection/ParameterModifier.cs

@@ -32,16 +32,20 @@
 using System;
 
 namespace System.Reflection {
+	[Serializable]
 	public struct ParameterModifier {
-		private bool[] data;
+		private bool[] _byref;
 		
-		public ParameterModifier (int paramaterCount) {
-			data = new bool [paramaterCount];
+		public ParameterModifier (int parameterCount) {
+			if (parameterCount <= 0)
+				throw new ArgumentException ("Must specify one or more parameters.");
+
+			_byref = new bool[parameterCount];
 		}
 
 		public bool this [int index] {
-			get {return data [index];} 
-			set {data [index] = value;}
+			get {return _byref [index];} 
+			set {_byref [index] = value;}
 		}
 
 	}