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
- SelectionService.cs
- HwndTarget.cs
- AppDomainAttributes.cs
- OrderedDictionary.cs
- Merger.cs
- SqlUtils.cs
- ButtonBaseAutomationPeer.cs
- HMACSHA1.cs
- _HelperAsyncResults.cs
- FormParameter.cs
- Context.cs
- OracleParameterBinding.cs
- UInt16Converter.cs
- PeerInvitationResponse.cs
- SafeSecurityHandles.cs
- TreeNodeCollection.cs
- EntityKeyElement.cs
- OleAutBinder.cs
- FormViewInsertedEventArgs.cs
- AbstractExpressions.cs
- SqlParameter.cs
- SiteMap.cs
- AdjustableArrowCap.cs
- CodeIdentifier.cs
- _SslStream.cs
- UIElementIsland.cs
- HistoryEventArgs.cs
- ModuleBuilder.cs
- MaskedTextProvider.cs
- XmlArrayItemAttribute.cs
- DataRow.cs
- PKCS1MaskGenerationMethod.cs
- TextEditorContextMenu.cs
- UdpDiscoveryEndpoint.cs
- WebPartCollection.cs
- SmiRecordBuffer.cs
- SchemaInfo.cs
- MeasurementDCInfo.cs
- StrongNameUtility.cs
- httpapplicationstate.cs
- BaseCollection.cs
- SQLBinaryStorage.cs
- ScriptManagerProxy.cs
- UserNameSecurityTokenProvider.cs
- FileUpload.cs
- VScrollBar.cs
- EntityContainerEntitySet.cs
- PageAdapter.cs
- LambdaCompiler.cs
- Choices.cs
- FontEditor.cs
- ObjectView.cs
- RouteValueExpressionBuilder.cs
- MissingSatelliteAssemblyException.cs
- XmlILConstructAnalyzer.cs
- ControlPropertyNameConverter.cs
- ALinqExpressionVisitor.cs
- CDSsyncETWBCLProvider.cs
- Point3DCollection.cs
- StyleConverter.cs
- SQLInt64Storage.cs
- WebPartConnection.cs
- DataConnectionHelper.cs
- IImplicitResourceProvider.cs
- ProjectionCamera.cs
- CompilerGlobalScopeAttribute.cs
- TableSectionStyle.cs
- WindowsListViewSubItem.cs
- TrackingMemoryStream.cs
- FrameworkElementFactory.cs
- BinaryFormatter.cs
- StorageRoot.cs
- NumberSubstitution.cs
- OrderByQueryOptionExpression.cs
- DataServiceBuildProvider.cs
- XmlSchemaComplexContent.cs
- XmlTypeMapping.cs
- SspiSecurityTokenProvider.cs
- HideDisabledControlAdapter.cs
- HttpCookieCollection.cs
- ApplicationDirectoryMembershipCondition.cs
- SqlUserDefinedAggregateAttribute.cs
- SQLBytes.cs
- OleDbConnectionInternal.cs
- XPathBinder.cs
- HelpKeywordAttribute.cs
- ConfigurationSchemaErrors.cs
- DomNameTable.cs
- AnimatedTypeHelpers.cs
- DecoratedNameAttribute.cs
- CopyAttributesAction.cs
- BitmapDownload.cs
- AdRotator.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- XmlSchemaAnyAttribute.cs
- NoneExcludedImageIndexConverter.cs
- EdmSchemaAttribute.cs
- ShaderEffect.cs
- TabControlEvent.cs
- Helpers.cs