Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / AsyncCompletedEventArgs.cs / 1305376 / AsyncCompletedEventArgs.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel
{
using System.Diagnostics.CodeAnalysis;
using System.Security.Permissions;
using System.Reflection;
[HostProtection(SharedState = true)]
public class AsyncCompletedEventArgs : System.EventArgs
{
private readonly Exception error;
private readonly bool cancelled;
private readonly object userState;
public AsyncCompletedEventArgs(Exception error, bool cancelled, object userState)
{
this.error = error;
this.cancelled = cancelled;
this.userState = userState;
}
[ SRDescription(SR.Async_AsyncEventArgs_Cancelled) ]
public bool Cancelled
{
get { return cancelled; }
}
[ SRDescription(SR.Async_AsyncEventArgs_Error) ]
public Exception Error
{
get { return error; }
}
[ SRDescription(SR.Async_AsyncEventArgs_UserState) ]
public object UserState
{
get { return userState; }
}
// Call from every result 'getter'. Will throw if there's an error or operation was cancelled
//
[SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
protected void RaiseExceptionIfNecessary()
{
if (Error != null)
{
throw new TargetInvocationException(SR.GetString(SR.Async_ExceptionOccurred), Error);
}
else if (Cancelled)
{
throw new InvalidOperationException(SR.GetString(SR.Async_OperationCancelled));
}
}
}
}
// 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
- ListViewGroup.cs
- ServiceContractListItemList.cs
- TextContainer.cs
- ConnectionPointCookie.cs
- ConcatQueryOperator.cs
- ItemsPanelTemplate.cs
- CatalogZoneBase.cs
- BaseProcessor.cs
- TextContainerChangedEventArgs.cs
- StrokeNodeEnumerator.cs
- ToolStripRenderEventArgs.cs
- ArraySubsetEnumerator.cs
- HttpApplicationFactory.cs
- GacUtil.cs
- ConstrainedDataObject.cs
- ParameterElement.cs
- Timer.cs
- XmlDictionaryWriter.cs
- UrlMappingsModule.cs
- ArraySegment.cs
- ConstraintEnumerator.cs
- TopClause.cs
- ListSortDescription.cs
- SqlRowUpdatingEvent.cs
- Serializer.cs
- ArrayList.cs
- RawKeyboardInputReport.cs
- webeventbuffer.cs
- AssociationSetMetadata.cs
- VarRemapper.cs
- QueueProcessor.cs
- PersonalizationProvider.cs
- UpdateException.cs
- PrimitiveDataContract.cs
- EntityDescriptor.cs
- ObjectListCommandEventArgs.cs
- TableSectionStyle.cs
- UnaryQueryOperator.cs
- AttachedPropertyMethodSelector.cs
- TdsParameterSetter.cs
- AsymmetricKeyExchangeDeformatter.cs
- VectorAnimationUsingKeyFrames.cs
- Ref.cs
- SimplePropertyEntry.cs
- RepeatInfo.cs
- MergeFilterQuery.cs
- EditorPartDesigner.cs
- InternalConfigHost.cs
- Assert.cs
- InheritablePropertyChangeInfo.cs
- AnimationClock.cs
- ComEventsInfo.cs
- CodeTypeReference.cs
- FrameworkElementFactory.cs
- EdmFunctionAttribute.cs
- HttpWriter.cs
- RecognizedWordUnit.cs
- TableLayoutPanelCodeDomSerializer.cs
- HttpStreamXmlDictionaryReader.cs
- DesignerCategoryAttribute.cs
- SQLSingle.cs
- WebPartCancelEventArgs.cs
- RijndaelManagedTransform.cs
- DataSourceComponent.cs
- TextParagraphProperties.cs
- ConfigurationElementProperty.cs
- MeasurementDCInfo.cs
- SystemIPGlobalProperties.cs
- SynchronizedInputHelper.cs
- CalendarDesigner.cs
- ErrorHandler.cs
- ListViewSelectEventArgs.cs
- HtmlTitle.cs
- PinnedBufferMemoryStream.cs
- BuildDependencySet.cs
- WorkflowMarkupSerializer.cs
- HitTestWithGeometryDrawingContextWalker.cs
- DetailsViewUpdateEventArgs.cs
- AlternateViewCollection.cs
- EntityContainerEntitySet.cs
- sqlnorm.cs
- BrowsableAttribute.cs
- PenLineCapValidation.cs
- DesignerObject.cs
- XmlAttributeCache.cs
- DateTimeUtil.cs
- EventLogEntryCollection.cs
- ChangeToolStripParentVerb.cs
- CodeNamespaceImportCollection.cs
- NavigatorInvalidBodyAccessException.cs
- QilPatternFactory.cs
- ListViewAutomationPeer.cs
- ListQueryResults.cs
- XmlSerializationGeneratedCode.cs
- FixedPageStructure.cs
- DesigntimeLicenseContext.cs
- ExtenderControl.cs
- ViewPort3D.cs
- ServiceDescriptionContext.cs
- WebPartsSection.cs