//
// 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 ()
: 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