Merge pull request #1323 from StephenMcConnel/bug-23591
[mono.git] / mcs / class / corlib / System.Reflection / ExceptionHandlingClause.cs
index f02544fa3f4bb21b8574caa6d157a4039950b538..ed94d54b17a487493637cae25b9e2657b4f345ca 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 using System;
+using System.Globalization;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection {
 
-       public sealed class ExceptionHandlingClause {
+       [ComVisible (true)]
+       [StructLayout (LayoutKind.Sequential)]
+#if NET_4_0
+       public
+#else
+       public sealed
+#endif
+       class ExceptionHandlingClause {
                #region Sync with reflection.h
                internal Type catch_type;
                internal int filter_offset;
-               internal ExceptionHandlingClauseFlags flags;
+               internal ExceptionHandlingClauseOptions flags;
                internal int try_offset;
                internal int try_length;
                internal int handler_offset;
                internal int handler_length;
                #endregion
 
-               internal ExceptionHandlingClause () {
+#if NET_4_0
+               protected
+#else
+               internal
+#endif
+               ExceptionHandlingClause () {
                }
 
-               public Type CatchType {
+               public
+#if NET_4_0
+               virtual
+#endif
+               Type CatchType {
                        get {
                                return catch_type;
                        }
                }
 
-               public int FilterOffset {
+               public
+#if NET_4_0
+               virtual
+#endif
+               int FilterOffset {
                        get {
                                return filter_offset;
                        }
                }
 
-               public ExceptionHandlingClauseFlags Flags {
+               public
+#if NET_4_0
+               virtual
+#endif
+               ExceptionHandlingClauseOptions Flags {
                        get {
                                return flags;
                        }
                }
 
-               public int HandlerLength {
+               public
+#if NET_4_0
+               virtual
+#endif
+               int HandlerLength {
                        get {
                                return handler_length;
                        }
                }
 
-               public int HandlerOffset {
+               public
+#if NET_4_0
+               virtual
+#endif
+               int HandlerOffset {
                        get {
                                return handler_offset;
                        }
                }
 
-               public int TryLength {
+               public
+#if NET_4_0
+               virtual
+#endif
+               int TryLength {
                        get {
                                return try_length;
                        }
                }
 
-               public int TryOffset {
+               public
+#if NET_4_0
+               virtual
+#endif
+               int TryOffset {
                        get {
                                return try_offset;
                        }
                }
+
+               public override string ToString ()
+               {
+                       string ret = String.Format ("Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
+                                                   flags, try_offset, try_length, handler_offset, handler_length);
+                       if (catch_type != null)
+                               ret = String.Format ("{0}, CatchType={1}", ret, catch_type);
+                       if (flags == ExceptionHandlingClauseOptions.Filter)
+                               ret = String.Format ("{0}, FilterOffset={1}", ret, filter_offset);
+                       return ret;
+               }
        }
 
 }
-
-#endif