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
- NgenServicingAttributes.cs
- GenericAuthenticationEventArgs.cs
- NativeMethods.cs
- Dispatcher.cs
- diagnosticsswitches.cs
- RemotingConfigParser.cs
- CharUnicodeInfo.cs
- EnumMemberAttribute.cs
- PeerCollaboration.cs
- CloudCollection.cs
- MarkedHighlightComponent.cs
- codemethodreferenceexpression.cs
- SubpageParaClient.cs
- CompletionProxy.cs
- SizeAnimation.cs
- StdRegProviderWrapper.cs
- ExpressionConverter.cs
- OrderedDictionary.cs
- ControllableStoryboardAction.cs
- CacheDependency.cs
- TypeListConverter.cs
- StorageConditionPropertyMapping.cs
- DataBindingList.cs
- dtdvalidator.cs
- AudioStateChangedEventArgs.cs
- ColorTransform.cs
- ApplicationFileParser.cs
- PropertyDescriptorGridEntry.cs
- DbSetClause.cs
- TextElement.cs
- WebPartsPersonalizationAuthorization.cs
- SQLInt64.cs
- Converter.cs
- CompositeFontInfo.cs
- NotifyCollectionChangedEventArgs.cs
- SqlCachedBuffer.cs
- HttpResponseHeader.cs
- DelegatedStream.cs
- SimpleWebHandlerParser.cs
- BasePropertyDescriptor.cs
- NoneExcludedImageIndexConverter.cs
- ViewStateModeByIdAttribute.cs
- CompositeDispatchFormatter.cs
- InstanceKey.cs
- OrderedDictionary.cs
- MemberAccessException.cs
- Rectangle.cs
- ArgumentOutOfRangeException.cs
- DataGridHeaderBorder.cs
- AcceleratedTokenAuthenticator.cs
- LogicalExpressionTypeConverter.cs
- AttachedAnnotationChangedEventArgs.cs
- CompositeCollectionView.cs
- ComEventsHelper.cs
- ConfigXmlAttribute.cs
- ErrorEventArgs.cs
- ConditionalDesigner.cs
- MemberPathMap.cs
- TargetControlTypeAttribute.cs
- HwndSubclass.cs
- CodePageUtils.cs
- SafeLibraryHandle.cs
- ItemList.cs
- AdministrationHelpers.cs
- EdgeProfileValidation.cs
- MetadataUtilsSmi.cs
- Util.cs
- RadialGradientBrush.cs
- MetaForeignKeyColumn.cs
- EvidenceTypeDescriptor.cs
- TableProviderWrapper.cs
- DragStartedEventArgs.cs
- NegotiationTokenAuthenticator.cs
- HttpFileCollection.cs
- DefaultValueConverter.cs
- QueryPageSettingsEventArgs.cs
- ConstantProjectedSlot.cs
- UIntPtr.cs
- HitTestParameters3D.cs
- ObjectDataSourceView.cs
- DelegatingConfigHost.cs
- DecimalStorage.cs
- XmlValidatingReaderImpl.cs
- ReadContentAsBinaryHelper.cs
- CollectionChangeEventArgs.cs
- RunInstallerAttribute.cs
- EndpointConfigContainer.cs
- CodeLabeledStatement.cs
- ToolboxComponentsCreatingEventArgs.cs
- PenLineJoinValidation.cs
- IconHelper.cs
- GraphicsContainer.cs
- PrintingPermissionAttribute.cs
- FileInfo.cs
- QilInvoke.cs
- SEHException.cs
- ConsoleTraceListener.cs
- Membership.cs
- DashStyles.cs
- PassportIdentity.cs