Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ //// 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
- ClassDataContract.cs
- BrushValueSerializer.cs
- OleStrCAMarshaler.cs
- Int64Storage.cs
- FileUtil.cs
- VisualProxy.cs
- EventSchemaTraceListener.cs
- WebPartDescriptionCollection.cs
- RadialGradientBrush.cs
- ReadOnlyDataSourceView.cs
- CoTaskMemSafeHandle.cs
- SafeMILHandle.cs
- CodeExpressionStatement.cs
- DataGridBeginningEditEventArgs.cs
- CurrencyWrapper.cs
- ReceiveContext.cs
- PathFigure.cs
- BrushValueSerializer.cs
- SeparatorAutomationPeer.cs
- UnsafeNativeMethods.cs
- ConnectionStringsSection.cs
- ObjectDataSourceStatusEventArgs.cs
- MappingItemCollection.cs
- XmlSchemaAppInfo.cs
- DragEventArgs.cs
- ReliableChannelListener.cs
- StringArrayConverter.cs
- SendContent.cs
- ObjectHandle.cs
- HashJoinQueryOperatorEnumerator.cs
- X509InitiatorCertificateServiceElement.cs
- RotateTransform.cs
- RandomNumberGenerator.cs
- XmlIlVisitor.cs
- Span.cs
- CompModSwitches.cs
- Ops.cs
- GuidConverter.cs
- _NativeSSPI.cs
- FullTextBreakpoint.cs
- TypeUtil.cs
- PropertyGeneratedEventArgs.cs
- DetailsViewPagerRow.cs
- ComEventsInfo.cs
- ReachFixedDocumentSerializer.cs
- IProvider.cs
- Vector3DCollectionValueSerializer.cs
- InternalBufferManager.cs
- IPipelineRuntime.cs
- ResourceType.cs
- CryptoApi.cs
- HotCommands.cs
- PointCollection.cs
- KoreanCalendar.cs
- TypeDescriptor.cs
- PointAnimationClockResource.cs
- ContentFilePart.cs
- QueueAccessMode.cs
- XmlSequenceWriter.cs
- DSASignatureFormatter.cs
- QilCloneVisitor.cs
- DataControlField.cs
- WindowsMenu.cs
- PrivateFontCollection.cs
- VisualStyleElement.cs
- Point3DKeyFrameCollection.cs
- SubtreeProcessor.cs
- WebPartConnectionsCancelEventArgs.cs
- RegionInfo.cs
- ResourceProviderFactory.cs
- DesignerValidationSummaryAdapter.cs
- MultilineStringConverter.cs
- EncryptedKey.cs
- newinstructionaction.cs
- LiteralControl.cs
- XmlValidatingReader.cs
- SyndicationContent.cs
- OdbcDataAdapter.cs
- StructuralObject.cs
- WindowsIdentity.cs
- InteropBitmapSource.cs
- StringResourceManager.cs
- LocalizabilityAttribute.cs
- DynamicDataManager.cs
- ProtocolsConfiguration.cs
- TypeConverterValueSerializer.cs
- XmlNotation.cs
- EnumerableRowCollectionExtensions.cs
- RequestCachingSection.cs
- DoubleAnimationUsingKeyFrames.cs
- NamespaceEmitter.cs
- HelpProvider.cs
- InkCanvasSelection.cs
- TextMarkerSource.cs
- ElementHostAutomationPeer.cs
- KeyEvent.cs
- NegotiateStream.cs
- StylusEventArgs.cs
- DbConnectionStringCommon.cs
- BuildProvider.cs