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
- ProxyGenerator.cs
- RuntimeEnvironment.cs
- SessionPageStateSection.cs
- DataReaderContainer.cs
- TypefaceCollection.cs
- HitTestResult.cs
- SrgsElementFactoryCompiler.cs
- ClientEventManager.cs
- PersianCalendar.cs
- ElementsClipboardData.cs
- Version.cs
- CodeMemberEvent.cs
- LogRecordSequence.cs
- TcpChannelListener.cs
- KeyInstance.cs
- ResourceManagerWrapper.cs
- RectAnimationBase.cs
- ErrorHandler.cs
- Nodes.cs
- Control.cs
- AdRotator.cs
- StreamGeometryContext.cs
- FtpCachePolicyElement.cs
- MetadataFile.cs
- Char.cs
- FactoryMaker.cs
- TreeNodeStyleCollection.cs
- MsmqReceiveParameters.cs
- Process.cs
- HyperLinkDesigner.cs
- METAHEADER.cs
- ThousandthOfEmRealDoubles.cs
- LineSegment.cs
- StreamingContext.cs
- RefreshEventArgs.cs
- TableItemPattern.cs
- AssemblyNameProxy.cs
- FlowDocumentReaderAutomationPeer.cs
- StandardOleMarshalObject.cs
- PrintDialog.cs
- StringDictionaryWithComparer.cs
- IPEndPointCollection.cs
- Run.cs
- HierarchicalDataBoundControlAdapter.cs
- Assert.cs
- HostedTcpTransportManager.cs
- ColumnMapTranslator.cs
- ServiceDescriptions.cs
- ServerValidateEventArgs.cs
- SelectionChangedEventArgs.cs
- JsonReaderWriterFactory.cs
- FontSource.cs
- CustomWebEventKey.cs
- AliasedSlot.cs
- TransformDescriptor.cs
- DirectoryInfo.cs
- DocumentCollection.cs
- XamlBuildTaskServices.cs
- DocumentPageTextView.cs
- BitmapDecoder.cs
- PeerCustomResolverElement.cs
- ToolbarAUtomationPeer.cs
- TextEditorTables.cs
- OutOfProcStateClientManager.cs
- RichTextBoxConstants.cs
- Pipe.cs
- WebSysDefaultValueAttribute.cs
- SerializerProvider.cs
- SuppressIldasmAttribute.cs
- WindowsMenu.cs
- XmlDocument.cs
- MainMenu.cs
- RangeValidator.cs
- AssociatedControlConverter.cs
- XmlMessageFormatter.cs
- StylusButtonCollection.cs
- SystemFonts.cs
- RectIndependentAnimationStorage.cs
- Int32Converter.cs
- ContractCodeDomInfo.cs
- RuntimeIdentifierPropertyAttribute.cs
- SspiSafeHandles.cs
- PointCollection.cs
- RadioButtonStandardAdapter.cs
- ApplicationActivator.cs
- XmlImplementation.cs
- Composition.cs
- TextDecoration.cs
- SystemParameters.cs
- DesignerDataStoredProcedure.cs
- CodeAttributeArgument.cs
- CfgArc.cs
- ToolstripProfessionalRenderer.cs
- OwnerDrawPropertyBag.cs
- DefaultTextStore.cs
- SqlDataReader.cs
- FormsAuthenticationEventArgs.cs
- SafeProcessHandle.cs
- InstanceKeyCollisionException.cs
- OSFeature.cs