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
- InputLangChangeRequestEvent.cs
- DataBindEngine.cs
- Module.cs
- ShapeTypeface.cs
- UriTemplateMatchException.cs
- UpdateCompiler.cs
- PartitionResolver.cs
- Options.cs
- ZipIOLocalFileHeader.cs
- Matrix3DConverter.cs
- XmlIncludeAttribute.cs
- VideoDrawing.cs
- Visitor.cs
- IconConverter.cs
- SerialReceived.cs
- WebBrowser.cs
- TransactionOptions.cs
- ExpressionBindingCollection.cs
- SecurityKeyIdentifierClause.cs
- CFGGrammar.cs
- BrowserCapabilitiesCompiler.cs
- SafeHandles.cs
- GroupBox.cs
- PanelDesigner.cs
- Rule.cs
- QueryContinueDragEventArgs.cs
- GlobalEventManager.cs
- TrackingExtract.cs
- WebBaseEventKeyComparer.cs
- StickyNoteHelper.cs
- CustomCategoryAttribute.cs
- RuleValidation.cs
- InternalDuplexBindingElement.cs
- GroupAggregateExpr.cs
- XmlChoiceIdentifierAttribute.cs
- ItemList.cs
- OrderedHashRepartitionStream.cs
- DisableDpiAwarenessAttribute.cs
- GlobalEventManager.cs
- ByteStream.cs
- ConstantExpression.cs
- HighlightVisual.cs
- CodeDomConfigurationHandler.cs
- CheckBox.cs
- WorkflowApplicationEventArgs.cs
- SqlCommand.cs
- ConsumerConnectionPoint.cs
- ButtonRenderer.cs
- DataControlFieldHeaderCell.cs
- XPathNodeHelper.cs
- AuthenticateEventArgs.cs
- LookupBindingPropertiesAttribute.cs
- DataGridRowDetailsEventArgs.cs
- ServiceNameElementCollection.cs
- WebBrowserBase.cs
- SubMenuStyleCollection.cs
- UnauthorizedWebPart.cs
- DecimalStorage.cs
- RegisteredArrayDeclaration.cs
- UpdateTracker.cs
- EntityDataSourceState.cs
- AssemblyBuilder.cs
- DocumentPageTextView.cs
- XmlChoiceIdentifierAttribute.cs
- DateTimeConstantAttribute.cs
- PresentationUIStyleResources.cs
- IPCCacheManager.cs
- QueryStringConverter.cs
- URL.cs
- BulletedListEventArgs.cs
- StrokeNodeOperations.cs
- FontStyles.cs
- MarkupProperty.cs
- ReachSerializerAsync.cs
- MemoryFailPoint.cs
- LightweightCodeGenerator.cs
- DefaultTextStore.cs
- ToolStripSeparatorRenderEventArgs.cs
- CompositeFontFamily.cs
- TrustLevel.cs
- HandlerWithFactory.cs
- Int32Storage.cs
- TableLayout.cs
- DeclaredTypeElementCollection.cs
- PageParser.cs
- CodeTypeMemberCollection.cs
- Transform.cs
- LoadedOrUnloadedOperation.cs
- FloaterParagraph.cs
- IndexerNameAttribute.cs
- TextLineBreak.cs
- ResourceReferenceExpression.cs
- CloseCryptoHandleRequest.cs
- MsmqInputSessionChannel.cs
- XmlSchemaIdentityConstraint.cs
- SBCSCodePageEncoding.cs
- HealthMonitoringSection.cs
- HandleCollector.cs
- ScrollPattern.cs
- DataColumnMappingCollection.cs