Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Threading / Tasks / TaskCanceledException.cs / 1305376 / TaskCanceledException.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// TaskCanceledException.cs
//
// [....]
//
// An exception for task cancellations.
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading.Tasks
{
///
/// Represents an exception used to communicate task cancellation.
///
[Serializable]
public class TaskCanceledException : OperationCanceledException
{
[NonSerialized]
private Task m_canceledTask; // The task which has been canceled.
///
/// Initializes a new instance of the class.
///
public TaskCanceledException() : base(Environment.GetResourceString("TaskCanceledException_ctor_DefaultMessage"))
{
}
///
/// Initializes a new instance of the
/// class with a specified error message.
///
/// The error message that explains the reason for the exception.
public TaskCanceledException(string message) : base(message)
{
}
///
/// Initializes a new instance of the
/// class with a specified error message and a reference to the inner exception that is the cause of
/// this exception.
///
/// The error message that explains the reason for the exception.
/// The exception that is the cause of the current exception.
public TaskCanceledException(string message, Exception innerException) : base(message, innerException)
{
}
///
/// Initializes a new instance of the class
/// with a reference to the that has been canceled.
///
/// A task that has been canceled.
public TaskCanceledException(Task task) :
base(Environment.GetResourceString("TaskCanceledException_ctor_DefaultMessage"), task!=null ? task.CancellationToken:new CancellationToken())
{
m_canceledTask = task;
}
///
/// Initializes a new instance of the
/// class with serialized data.
///
/// The that holds the serialized object data about the exception being thrown.
/// The that contains contextual information about the source or destination.
protected TaskCanceledException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
///
/// Gets the task associated with this exception.
///
///
/// It is permissible for no Task to be associated with a
/// , in which case
/// this property will return null.
///
public Task Task
{
get { return m_canceledTask; }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// TaskCanceledException.cs
//
// [....]
//
// An exception for task cancellations.
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Threading.Tasks
{
///
/// Represents an exception used to communicate task cancellation.
///
[Serializable]
public class TaskCanceledException : OperationCanceledException
{
[NonSerialized]
private Task m_canceledTask; // The task which has been canceled.
///
/// Initializes a new instance of the class.
///
public TaskCanceledException() : base(Environment.GetResourceString("TaskCanceledException_ctor_DefaultMessage"))
{
}
///
/// Initializes a new instance of the
/// class with a specified error message.
///
/// The error message that explains the reason for the exception.
public TaskCanceledException(string message) : base(message)
{
}
///
/// Initializes a new instance of the
/// class with a specified error message and a reference to the inner exception that is the cause of
/// this exception.
///
/// The error message that explains the reason for the exception.
/// The exception that is the cause of the current exception.
public TaskCanceledException(string message, Exception innerException) : base(message, innerException)
{
}
///
/// Initializes a new instance of the class
/// with a reference to the that has been canceled.
///
/// A task that has been canceled.
public TaskCanceledException(Task task) :
base(Environment.GetResourceString("TaskCanceledException_ctor_DefaultMessage"), task!=null ? task.CancellationToken:new CancellationToken())
{
m_canceledTask = task;
}
///
/// Initializes a new instance of the
/// class with serialized data.
///
/// The that holds the serialized object data about the exception being thrown.
/// The that contains contextual information about the source or destination.
protected TaskCanceledException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
///
/// Gets the task associated with this exception.
///
///
/// It is permissible for no Task to be associated with a
/// , in which case
/// this property will return null.
///
public Task Task
{
get { return m_canceledTask; }
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CustomAttributeBuilder.cs
- HttpResponse.cs
- CodeNamespaceImportCollection.cs
- TrustLevelCollection.cs
- PageTheme.cs
- SiteMapSection.cs
- SafeMILHandleMemoryPressure.cs
- SkipQueryOptionExpression.cs
- ResourceManager.cs
- OneOfElement.cs
- SystemIcmpV4Statistics.cs
- RegistryConfigurationProvider.cs
- IRCollection.cs
- Debugger.cs
- MemberAccessException.cs
- GeneratedCodeAttribute.cs
- GestureRecognitionResult.cs
- DataGridColumn.cs
- XmlUtil.cs
- TableHeaderCell.cs
- SizeChangedInfo.cs
- GCHandleCookieTable.cs
- WsiProfilesElementCollection.cs
- documentsequencetextcontainer.cs
- WizardForm.cs
- TypeSource.cs
- RowVisual.cs
- TypefaceMap.cs
- ClientEventManager.cs
- EntityContainerEmitter.cs
- RuntimeTrackingProfile.cs
- RsaSecurityToken.cs
- X509CertificateClaimSet.cs
- PipelineComponent.cs
- mongolianshape.cs
- ToolStripPanel.cs
- ADConnectionHelper.cs
- SizeAnimationUsingKeyFrames.cs
- TokenBasedSet.cs
- StringSource.cs
- Environment.cs
- Inline.cs
- Thread.cs
- SoapMessage.cs
- MatrixAnimationBase.cs
- Properties.cs
- ToolStripMenuItem.cs
- BCryptSafeHandles.cs
- RemoveStoryboard.cs
- NegotiationTokenAuthenticatorStateCache.cs
- InkCanvasSelectionAdorner.cs
- Currency.cs
- Binding.cs
- SqlReferenceCollection.cs
- PackWebRequest.cs
- WebPartConnectionsCloseVerb.cs
- WebPartDisplayModeCancelEventArgs.cs
- IdleTimeoutMonitor.cs
- XmlSerializerFormatAttribute.cs
- Manipulation.cs
- OdbcConnectionFactory.cs
- M3DUtil.cs
- BasicExpressionVisitor.cs
- TrackingProfile.cs
- CellParaClient.cs
- TextAutomationPeer.cs
- FormView.cs
- XmlEventCache.cs
- OleDbEnumerator.cs
- SQLMembershipProvider.cs
- validationstate.cs
- Condition.cs
- FontUnitConverter.cs
- XmlAttribute.cs
- HostSecurityManager.cs
- XhtmlBasicListAdapter.cs
- HandlerWithFactory.cs
- BinaryWriter.cs
- Part.cs
- ZoneMembershipCondition.cs
- SQLInt64.cs
- SqlTriggerAttribute.cs
- NumericUpDownAcceleration.cs
- SineEase.cs
- ItemCheckEvent.cs
- KeyInterop.cs
- WorkflowInspectionServices.cs
- HashRepartitionEnumerator.cs
- OrderPreservingSpoolingTask.cs
- ApplicationGesture.cs
- Activator.cs
- MessageQueueException.cs
- SemanticResultKey.cs
- SpeechRecognizer.cs
- SettingsBindableAttribute.cs
- MetadataCacheItem.cs
- TableHeaderCell.cs
- TextSelection.cs
- Converter.cs
- ToolBarButton.cs