X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem%2FOperationCanceledException.cs;h=6849961a0760f25db350f168579fe7f996d7ffb4;hb=c7ba3619f367944b6740c7e335e2a96499999859;hp=115aa27aed905d5a76ac56d9275dd84a8d0595eb;hpb=0443306d611d0830e27327e1f0a3ef3457dfa535;p=mono.git diff --git a/mcs/class/corlib/System/OperationCanceledException.cs b/mcs/class/corlib/System/OperationCanceledException.cs index 115aa27aed9..6849961a076 100644 --- a/mcs/class/corlib/System/OperationCanceledException.cs +++ b/mcs/class/corlib/System/OperationCanceledException.cs @@ -1,7 +1,9 @@ // // System.OperationCanceledException.cs // - +// Authors: +// Zoltan Varga +// Jérémie Laval // // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // @@ -26,15 +28,17 @@ // 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