Merge pull request #1229 from andreiagaita/master
[mono.git] / mcs / class / corlib / System.Reflection / CustomAttributeTypedArgument.cs
index 41520a144b53c26bd1ad9f0c4499a3fe11f035ba..c73e32c9a949f817af86a8ae42ed854606be4613 100644 (file)
@@ -27,7 +27,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 
 using System;
 using System.Runtime.InteropServices;
@@ -41,8 +40,14 @@ namespace System.Reflection {
                Type argumentType;
                object value;
 
-               internal CustomAttributeTypedArgument (Type argumentType, object value)
+#if NET_4_0
+               public
+#endif
+               CustomAttributeTypedArgument (Type argumentType, object value)
                {
+                       if (argumentType == null)
+                               throw new ArgumentNullException ("argumentType");
+
                        this.argumentType = argumentType;
                        this.value = value;
 
@@ -57,6 +62,17 @@ namespace System.Reflection {
                                this.value = new ReadOnlyCollection <CustomAttributeTypedArgument> (new_value);
                        }
                }
+               
+#if NET_4_0
+               public CustomAttributeTypedArgument (object value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException ("value");
+
+                       this.argumentType = value.GetType ();
+                       this.value = value;
+               }
+#endif
 
                public Type ArgumentType {
                        get {
@@ -110,5 +126,4 @@ namespace System.Reflection {
 
 }
 
-#endif