[runtime] Updates comments.
[mono.git] / mcs / class / corlib / System / OperationCanceledException.cs
index 115aa27aed905d5a76ac56d9275dd84a8d0595eb..6849961a0760f25db350f168579fe7f996d7ffb4 100644 (file)
@@ -1,7 +1,9 @@
 //
 // System.OperationCanceledException.cs
 //
-
+// Authors:
+//   Zoltan Varga  <vargaz@freemail.hu>
+//   Jérémie Laval <jeremie.laval@gmail.com>
 //
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 //
 
 using System.Runtime.Serialization;
-
-#if NET_2_0
+using System.Runtime.InteropServices;
+using System.Threading;
 
 namespace System
 {
        [Serializable]
+       [ComVisible (true)]
        public class OperationCanceledException : SystemException
        {
                const int Result = unchecked ((int)0x8013153b);
+               CancellationToken? token;
 
                // Constructors
                public OperationCanceledException ()
@@ -59,7 +63,31 @@ namespace System
                        : base (info, context)
                {
                }
+               
+               public OperationCanceledException (CancellationToken token)
+                       : this ()
+               {
+                       this.token = token;
+               }
+               
+               public OperationCanceledException (string message, CancellationToken token)
+                       : this (message)
+               {
+                       this.token = token;
+               }
+               
+               public OperationCanceledException (string message, Exception innerException, CancellationToken token)
+                       : base (message, innerException)
+               {
+                       this.token = token;
+               }
+               
+               public CancellationToken CancellationToken {
+                       get {
+                               if (token == null)
+                                       return CancellationToken.None;
+                               return token.Value;
+                       }
+               }
        }
 }
-
-#endif