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
- ActivityExecutorDelegateInfo.cs
- ClientSettingsStore.cs
- XamlPathDataSerializer.cs
- ImpersonateTokenRef.cs
- SingleKeyFrameCollection.cs
- XmlBaseReader.cs
- ConstraintCollection.cs
- NativeMethodsCLR.cs
- MessageEncoder.cs
- Rule.cs
- ProtocolElementCollection.cs
- DataGridViewComboBoxCell.cs
- BinaryFormatterWriter.cs
- ButtonField.cs
- ViewLoader.cs
- GACIdentityPermission.cs
- ToolStripItemImageRenderEventArgs.cs
- ManualResetEvent.cs
- KeyFrames.cs
- PersonalizationProviderCollection.cs
- _KerberosClient.cs
- SqlDependency.cs
- ConfigXmlCDataSection.cs
- SingleConverter.cs
- Point4DConverter.cs
- UpDownEvent.cs
- TypeUsageBuilder.cs
- LineUtil.cs
- FixedSOMImage.cs
- ToolStripPanelRow.cs
- ProtocolsConfiguration.cs
- InputMethodStateChangeEventArgs.cs
- PageParserFilter.cs
- PageOutputQuality.cs
- TypeLibraryHelper.cs
- EventlogProvider.cs
- ObjectItemCollection.cs
- IISUnsafeMethods.cs
- DesignerVerb.cs
- HandlerFactoryCache.cs
- XMLDiffLoader.cs
- WindowsTreeView.cs
- FormViewRow.cs
- XhtmlTextWriter.cs
- WorkflowServiceAttributesTypeConverter.cs
- FileAuthorizationModule.cs
- DrawTreeNodeEventArgs.cs
- FastEncoderStatics.cs
- TransformedBitmap.cs
- StdValidatorsAndConverters.cs
- TextEffectResolver.cs
- CornerRadiusConverter.cs
- DiscoveryInnerClientManaged11.cs
- Point3DCollectionConverter.cs
- SimpleType.cs
- DataGridItemCollection.cs
- SpecularMaterial.cs
- ToolboxDataAttribute.cs
- PixelShader.cs
- KnownIds.cs
- DisposableCollectionWrapper.cs
- MapPathBasedVirtualPathProvider.cs
- ColumnResizeUndoUnit.cs
- BasicDesignerLoader.cs
- AsymmetricSignatureFormatter.cs
- XmlNodeList.cs
- XmlLanguageConverter.cs
- UidManager.cs
- PropertyValueChangedEvent.cs
- SecurityRuntime.cs
- GroupBoxRenderer.cs
- ModulesEntry.cs
- MarkedHighlightComponent.cs
- CommandPlan.cs
- WebPartMenuStyle.cs
- ObservableDictionary.cs
- SubstitutionResponseElement.cs
- FileDialogCustomPlacesCollection.cs
- PriorityBinding.cs
- TreePrinter.cs
- XmlWhitespace.cs
- ListItemViewControl.cs
- ControlCachePolicy.cs
- EmbeddedMailObjectsCollection.cs
- Operators.cs
- FilterRepeater.cs
- BaseInfoTable.cs
- _IPv6Address.cs
- SqlStream.cs
- SafePointer.cs
- WebScriptEnablingBehavior.cs
- WebServiceData.cs
- CapiNative.cs
- Composition.cs
- SqlTypeConverter.cs
- BitmapEffectInput.cs
- XslTransform.cs
- SamlSubject.cs
- DataServiceConfiguration.cs
- EventDescriptorCollection.cs