Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / AsyncCompletedEventArgs.cs / 1 / 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)); } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionBuilderCollection.cs
- WebPartRestoreVerb.cs
- C14NUtil.cs
- ManagementScope.cs
- ProfileInfo.cs
- InlineObject.cs
- HttpCookieCollection.cs
- XmlSchemaObjectTable.cs
- MachineKey.cs
- ObjectTag.cs
- LineSegment.cs
- DbDataRecord.cs
- CharStorage.cs
- SerializerProvider.cs
- MarshalDirectiveException.cs
- ValidationHelper.cs
- ObjectDataSourceMethodEventArgs.cs
- DataListCommandEventArgs.cs
- TextServicesManager.cs
- SelectorItemAutomationPeer.cs
- ForceCopyBuildProvider.cs
- BoundPropertyEntry.cs
- StyleBamlTreeBuilder.cs
- OleStrCAMarshaler.cs
- EventListener.cs
- MetabaseSettings.cs
- EntityDataSourceColumn.cs
- XmlSchemaNotation.cs
- CompiledQueryCacheEntry.cs
- DataGridDesigner.cs
- PipeConnection.cs
- Serializer.cs
- XmlSchemaSet.cs
- ProtocolsSection.cs
- ListSourceHelper.cs
- CollectionType.cs
- NativeMethods.cs
- CodeArgumentReferenceExpression.cs
- PeerNeighborManager.cs
- DataBoundControlAdapter.cs
- ProgressBarAutomationPeer.cs
- NotificationContext.cs
- EventMappingSettingsCollection.cs
- SoapObjectWriter.cs
- ScopedKnownTypes.cs
- BmpBitmapEncoder.cs
- KeyValuePair.cs
- CounterSample.cs
- FullTextLine.cs
- SafeNativeMethodsOther.cs
- TranslateTransform.cs
- Types.cs
- XmlSchemaAnnotation.cs
- DataGridSortCommandEventArgs.cs
- BrushProxy.cs
- MenuItemCollection.cs
- KeyProperty.cs
- WebControlParameterProxy.cs
- NativeMethods.cs
- ComponentRenameEvent.cs
- QualifiedCellIdBoolean.cs
- Console.cs
- TiffBitmapDecoder.cs
- XsdDuration.cs
- dtdvalidator.cs
- nulltextcontainer.cs
- XmlSchemaFacet.cs
- StringAttributeCollection.cs
- DataSourceControlBuilder.cs
- _IPv4Address.cs
- SessionIDManager.cs
- BitStack.cs
- XmlDocument.cs
- MetaTableHelper.cs
- MoveSizeWinEventHandler.cs
- MenuEventArgs.cs
- ManagementException.cs
- FastEncoder.cs
- ReferenceEqualityComparer.cs
- SpAudioStreamWrapper.cs
- MimeBasePart.cs
- RemotingException.cs
- DataQuery.cs
- MailAddress.cs
- SHA1Managed.cs
- BrushMappingModeValidation.cs
- DataGridViewSelectedColumnCollection.cs
- ADConnectionHelper.cs
- SessionIDManager.cs
- SelectedDatesCollection.cs
- ActiveDocumentEvent.cs
- ContextMenuService.cs
- SafeFileMappingHandle.cs
- ClientRuntimeConfig.cs
- CheckoutException.cs
- ScrollProperties.cs
- MenuEventArgs.cs
- VisualStyleRenderer.cs
- SemaphoreSecurity.cs
- ListParaClient.cs