Code:
/ DotNET / DotNET / 8.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
- NavigatingCancelEventArgs.cs
- XsdBuildProvider.cs
- DataBindingCollection.cs
- externdll.cs
- ICspAsymmetricAlgorithm.cs
- BufferedStream.cs
- VisualBrush.cs
- MoveSizeWinEventHandler.cs
- ProfileBuildProvider.cs
- ConstrainedDataObject.cs
- Viewport3DAutomationPeer.cs
- ToolStripContextMenu.cs
- Logging.cs
- WhitespaceSignificantCollectionAttribute.cs
- ParseNumbers.cs
- IODescriptionAttribute.cs
- XmlNodeList.cs
- BitmapEffectInput.cs
- itemelement.cs
- NestedContainer.cs
- SqlDataSourceCommandEventArgs.cs
- SharedStatics.cs
- DataRowChangeEvent.cs
- HostedHttpContext.cs
- Schema.cs
- LineSegment.cs
- TextElement.cs
- SpellerInterop.cs
- Selector.cs
- FileDialogCustomPlaces.cs
- XmlSchemaValidator.cs
- MenuItemBindingCollection.cs
- Context.cs
- DeobfuscatingStream.cs
- PrinterResolution.cs
- RecordConverter.cs
- ImageListDesigner.cs
- Missing.cs
- DataGridPreparingCellForEditEventArgs.cs
- ElementUtil.cs
- OdbcStatementHandle.cs
- TrackBarRenderer.cs
- ContainerParagraph.cs
- TransportChannelFactory.cs
- NonVisualControlAttribute.cs
- ActivityXamlServices.cs
- PtsCache.cs
- Help.cs
- ModuleConfigurationInfo.cs
- GlyphInfoList.cs
- TemporaryBitmapFile.cs
- OracleFactory.cs
- SendingRequestEventArgs.cs
- OperationAbortedException.cs
- EmissiveMaterial.cs
- ClockGroup.cs
- ServiceX509SecurityTokenProvider.cs
- FontNamesConverter.cs
- ICollection.cs
- DocumentPageView.cs
- DataGridParentRows.cs
- TextParagraphProperties.cs
- xmlfixedPageInfo.cs
- CompoundFileDeflateTransform.cs
- SimpleRecyclingCache.cs
- TextEditorSpelling.cs
- isolationinterop.cs
- LicFileLicenseProvider.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- BulletedListDesigner.cs
- TrackBarRenderer.cs
- XmlCharCheckingWriter.cs
- _Semaphore.cs
- XmlSchemaSimpleTypeList.cs
- AnnotationAdorner.cs
- CachedPathData.cs
- ToolStripPanelRow.cs
- DirectoryObjectSecurity.cs
- CacheVirtualItemsEvent.cs
- TableLayoutPanelDesigner.cs
- MatrixTransform.cs
- HashHelper.cs
- EventArgs.cs
- Ipv6Element.cs
- DecimalConverter.cs
- EventWaitHandle.cs
- EllipticalNodeOperations.cs
- Interlocked.cs
- SessionStateSection.cs
- ErrorTableItemStyle.cs
- WindowsImpersonationContext.cs
- SemaphoreFullException.cs
- IPGlobalProperties.cs
- WebPartMenu.cs
- FileSystemEventArgs.cs
- State.cs
- StyleCollectionEditor.cs
- MatchNoneMessageFilter.cs
- SafeCoTaskMem.cs
- Item.cs