Merge pull request #3056 from BrzVlad/fix-multiple-binprot
[mono.git] / mcs / class / referencesource / mscorlib / system / runtime / interopservices / arraywithoffset.cs
index d6e858960bacb34dc2967830bc6cc2ffac59f49c..73778f3f4b142bf427734ef93fc793657594113e 100644 (file)
@@ -65,10 +65,22 @@ namespace System.Runtime.InteropServices {
             return !(a == b);
         }
 
+#if MONO
+        int CalculateCount()
+        {
+            Array a = m_array as Array;
+            if (a == null)
+                throw new ArgumentException ();
+
+            var total = a.Rank * a.Length;
+            return total - m_offset;
+        }
+#else
         [System.Security.SecurityCritical]  // auto-generated
         [ResourceExposure(ResourceScope.None)]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         private extern int CalculateCount();
+#endif
     
         private Object m_array;
         private int    m_offset;