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
- InlineObject.cs
- WinFormsSecurity.cs
- InputScope.cs
- CodeTypeDelegate.cs
- Dump.cs
- BatchParser.cs
- OutputCacheProfileCollection.cs
- sqlmetadatafactory.cs
- Row.cs
- FormsAuthenticationTicket.cs
- HttpResponse.cs
- DirectoryNotFoundException.cs
- MailHeaderInfo.cs
- MetadataException.cs
- TypeLoadException.cs
- XamlPointCollectionSerializer.cs
- LocatorPartList.cs
- XamlFigureLengthSerializer.cs
- AssemblyAttributesGoHere.cs
- SimpleWebHandlerParser.cs
- TextRunCacheImp.cs
- WebPartConnectionsConfigureVerb.cs
- CallbackDebugBehavior.cs
- RequestCache.cs
- DictionaryManager.cs
- EntityTypeEmitter.cs
- HMACSHA1.cs
- TextDecorations.cs
- ReceiveActivity.cs
- NetTcpSection.cs
- WmlLinkAdapter.cs
- AssemblyResourceLoader.cs
- SqlInfoMessageEvent.cs
- EnvironmentPermission.cs
- BaseResourcesBuildProvider.cs
- TextServicesLoader.cs
- RectKeyFrameCollection.cs
- FilterableAttribute.cs
- MetadataCacheItem.cs
- ToolStripDropDownItem.cs
- LinkDescriptor.cs
- NumericUpDown.cs
- CreateInstanceBinder.cs
- WebBrowser.cs
- SafeCertificateStore.cs
- MediaScriptCommandRoutedEventArgs.cs
- InlineObject.cs
- XPathItem.cs
- Encoder.cs
- EvidenceBase.cs
- IteratorDescriptor.cs
- WebDescriptionAttribute.cs
- cookiecollection.cs
- _ContextAwareResult.cs
- XmlSchemaAnnotation.cs
- ServiceModelSecurityTokenTypes.cs
- LiteralTextContainerControlBuilder.cs
- DynamicRenderer.cs
- Rect3D.cs
- PrincipalPermission.cs
- CfgParser.cs
- PackUriHelper.cs
- TraceProvider.cs
- LambdaCompiler.Unary.cs
- DesignerOptionService.cs
- CompiledQueryCacheKey.cs
- ControlCommandSet.cs
- WebSysDescriptionAttribute.cs
- CompiledQuery.cs
- ImpersonateTokenRef.cs
- MemberPathMap.cs
- X509SecurityTokenProvider.cs
- GlobalItem.cs
- ExtenderProvidedPropertyAttribute.cs
- HtmlInputHidden.cs
- _NTAuthentication.cs
- SharedDp.cs
- LinkedResourceCollection.cs
- ParseNumbers.cs
- SHA256.cs
- PersonalizationProviderCollection.cs
- Rotation3DAnimationBase.cs
- SelectionEditor.cs
- ResourceDisplayNameAttribute.cs
- ICspAsymmetricAlgorithm.cs
- StylesEditorDialog.cs
- QilValidationVisitor.cs
- ImageMap.cs
- SqlDataSourceQueryEditorForm.cs
- ContainerControlDesigner.cs
- Number.cs
- ScriptingWebServicesSectionGroup.cs
- SqlClientWrapperSmiStream.cs
- SqlNodeTypeOperators.cs
- DiscoveryReferences.cs
- IdnMapping.cs
- SessionEndingCancelEventArgs.cs
- WebPartManager.cs
- RegisterResponseInfo.cs
- PermissionRequestEvidence.cs