Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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)); } } } } // 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
- InvalidFilterCriteriaException.cs
- MethodExpression.cs
- File.cs
- EpmCustomContentDeSerializer.cs
- ViewgenGatekeeper.cs
- ConfigurationStrings.cs
- AddInDeploymentState.cs
- MonitoringDescriptionAttribute.cs
- GridViewHeaderRowPresenter.cs
- SimpleBitVector32.cs
- PropertyMappingExceptionEventArgs.cs
- HandlerFactoryCache.cs
- Int32CollectionConverter.cs
- _ListenerRequestStream.cs
- BridgeDataReader.cs
- ReadOnlyState.cs
- DataColumnChangeEvent.cs
- UrlMappingCollection.cs
- XmlSerializationGeneratedCode.cs
- ScriptControl.cs
- InstanceDataCollectionCollection.cs
- ClientFormsIdentity.cs
- MultiSelector.cs
- GetWinFXPath.cs
- AnimationTimeline.cs
- ProtocolsConfiguration.cs
- XmlChildEnumerator.cs
- RTLAwareMessageBox.cs
- HttpResponseWrapper.cs
- WebZone.cs
- ByteStreamGeometryContext.cs
- login.cs
- SchemaLookupTable.cs
- WindowsContainer.cs
- RelatedPropertyManager.cs
- GenerateScriptTypeAttribute.cs
- ProbeDuplex11AsyncResult.cs
- x509utils.cs
- WebPartConnectionsEventArgs.cs
- ObjectDataSourceDisposingEventArgs.cs
- DocumentSchemaValidator.cs
- ManualResetEvent.cs
- ConfigurationSettings.cs
- Exception.cs
- HMACSHA256.cs
- TabControl.cs
- X509Certificate2.cs
- WindowsAuthenticationModule.cs
- AspNetHostingPermission.cs
- StateInitialization.cs
- CultureInfoConverter.cs
- SystemColors.cs
- CacheAxisQuery.cs
- FixedSOMLineRanges.cs
- TransformCollection.cs
- MultiBinding.cs
- DelegatingConfigHost.cs
- ConnectionManagementElement.cs
- StreamMarshaler.cs
- BitmapPalette.cs
- FontInfo.cs
- DataSourceConverter.cs
- SqlTypesSchemaImporter.cs
- ProfileModule.cs
- ComponentResourceKey.cs
- DataGrid.cs
- TypeInitializationException.cs
- FileDataSourceCache.cs
- HtmlTableRow.cs
- OleDbErrorCollection.cs
- SamlAudienceRestrictionCondition.cs
- HttpStaticObjectsCollectionBase.cs
- WebDescriptionAttribute.cs
- ThemeInfoAttribute.cs
- SiteMapProvider.cs
- FaultContractInfo.cs
- DBConcurrencyException.cs
- ExpressionBindings.cs
- Odbc32.cs
- GlyphElement.cs
- MessageHeaderDescriptionCollection.cs
- SiteMap.cs
- XmlUtilWriter.cs
- listitem.cs
- RichTextBox.cs
- EntityDataSourceStatementEditor.cs
- ImportedPolicyConversionContext.cs
- ValidationEventArgs.cs
- MemberExpressionHelper.cs
- XmlSchemaSearchPattern.cs
- DataGridLength.cs
- WebSysDisplayNameAttribute.cs
- XmlSchemaComplexType.cs
- validation.cs
- EntityViewGenerationAttribute.cs
- XmlLanguageConverter.cs
- QueryConverter.cs
- DataGridViewComboBoxCell.cs
- UInt16Converter.cs
- AggregatePushdown.cs