2010-06-21 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 21 Jun 2010 13:17:23 +0000 (13:17 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 21 Jun 2010 13:17:23 +0000 (13:17 -0000)
* Type.cs (StructLayoutAttribute): This raises on v4.

* MonoType.cs (StructLayoutAttribute): Implement this
under v4.

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

mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/MonoType.cs
mcs/class/corlib/System/Type.cs

index 3bb1fee247feb74060e975ad3d0e74fb5200c1a7..11c13d7cae5dda2e6def073bbd86f9d78107a9e4 100644 (file)
@@ -1,3 +1,10 @@
+2010-06-21 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * Type.cs (StructLayoutAttribute): This raises on v4.
+
+       * MonoType.cs (StructLayoutAttribute): Implement this
+       under v4.
+
 2010-06-21  Jb Evain  <jbevain@novell.com>
 
        * TimeSpan.cs: add the net_4_0 parsing code in Moonlight.
index fe3bca9630b553fcffe19b47b5b6b7d64d126d1b..8db1a4a003ceaba370cae24d41911c4df921bde4 100644 (file)
@@ -33,6 +33,7 @@
 using System.Collections.Generic;
 using System.Globalization;
 using System.Reflection;
+using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
 using System.Runtime.Serialization;
 using System.Security;
@@ -725,6 +726,12 @@ namespace System
                {
                        get { return get_core_clr_security_level () == 1; }
                }
+
+               public override StructLayoutAttribute StructLayoutAttribute {
+                       get {
+                               return GetStructLayoutAttribute ();
+                       }
+               }
 #endif
 
        }
index a6d6f0d52f16dee34450ef32c1939198ccc7d6b1..b45fcba8d228e2d752c0f0f02d88aca0637a5111 100644 (file)
@@ -1580,29 +1580,38 @@ namespace System {
 
                public virtual StructLayoutAttribute StructLayoutAttribute {
                        get {
-                               LayoutKind kind;
+#if NET_4_0
+                               throw CreateNIE ();
+#else
+                               return GetStructLayoutAttribute ();
+#endif
+                       }
+               }
+               
+               internal StructLayoutAttribute GetStructLayoutAttribute ()
+               {
+                       LayoutKind kind;
 
-                               if (IsLayoutSequential)
-                                       kind = LayoutKind.Sequential;
-                               else if (IsExplicitLayout)
-                                       kind = LayoutKind.Explicit;
-                               else
-                                       kind = LayoutKind.Auto;
+                       if (IsLayoutSequential)
+                               kind = LayoutKind.Sequential;
+                       else if (IsExplicitLayout)
+                               kind = LayoutKind.Explicit;
+                       else
+                               kind = LayoutKind.Auto;
 
-                               StructLayoutAttribute attr = new StructLayoutAttribute (kind);
+                       StructLayoutAttribute attr = new StructLayoutAttribute (kind);
 
-                               if (IsUnicodeClass)
-                                       attr.CharSet = CharSet.Unicode;
-                               else if (IsAnsiClass)
-                                       attr.CharSet = CharSet.Ansi;
-                               else
-                                       attr.CharSet = CharSet.Auto;
+                       if (IsUnicodeClass)
+                               attr.CharSet = CharSet.Unicode;
+                       else if (IsAnsiClass)
+                               attr.CharSet = CharSet.Ansi;
+                       else
+                               attr.CharSet = CharSet.Auto;
 
-                               if (kind != LayoutKind.Auto)
-                                       GetPacking (out attr.Pack, out attr.Size);
+                       if (kind != LayoutKind.Auto)
+                               GetPacking (out attr.Pack, out attr.Size);
 
-                               return attr;
-                       }
+                       return attr;
                }
 
                internal object[] GetPseudoCustomAttributes ()