Merge pull request #409 from Alkarex/patch-1
[mono.git] / mcs / class / corlib / System.Runtime.InteropServices / MarshalAsAttribute.cs
index dde88d2805e671b6bdd56a10481a6db905df4a65..ac0dc4145bf48cb1de2325e824e43e2cd11404b5 100644 (file)
@@ -32,33 +32,32 @@ using System;
 
 namespace System.Runtime.InteropServices {
 
-#if NET_2_0
        [ComVisible(true)]
-#endif 
        [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | 
                         AttributeTargets.ReturnValue, Inherited=false)]
+       [StructLayout (LayoutKind.Sequential)]
        public sealed class MarshalAsAttribute : Attribute {
-               private UnmanagedType utype;
-               public UnmanagedType ArraySubType;
+               /*keep these fields in sync with object-internals.h*/
+#pragma warning disable 169, 414
                public string MarshalCookie;
-
-#if NET_2_0
                [ComVisible(true)]
-#endif 
                public string MarshalType;
 
-#if NET_2_0
                [ComVisible(true)]
-#endif 
                public Type MarshalTypeRef;
-               
+               public Type SafeArrayUserDefinedSubType;
+
+               private UnmanagedType utype;
+               public UnmanagedType ArraySubType;              
+#if !MOONLIGHT
                public VarEnum SafeArraySubType;
+#else
+               private int SafeArraySubType;
+#endif
                public int SizeConst;
-               public short SizeParamIndex;
-               public Type SafeArrayUserDefinedSubType;
-#if NET_2_0
                public int IidParameterIndex;
-#endif
+               public short SizeParamIndex;
+#pragma warning disable 169, 414
 
                public MarshalAsAttribute (short unmanagedType) {
                        utype = (UnmanagedType)unmanagedType;
@@ -69,5 +68,10 @@ namespace System.Runtime.InteropServices {
                public UnmanagedType Value {
                        get {return utype;}
                }
+
+               internal MarshalAsAttribute Copy ()
+               {
+                       return (MarshalAsAttribute)this.MemberwiseClone ();
+               }
        }
 }