Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / AsyncCompletedEventArgs.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextSegment.cs
- autovalidator.cs
- LocationReferenceEnvironment.cs
- ContentDefinition.cs
- TraceLevelStore.cs
- PageBuildProvider.cs
- ThrowHelper.cs
- SectionInput.cs
- Compress.cs
- QueueProcessor.cs
- IdentityHolder.cs
- FontDriver.cs
- DelegatingHeader.cs
- Frame.cs
- StreamingContext.cs
- XmlFormatWriterGenerator.cs
- isolationinterop.cs
- HandleCollector.cs
- DataBinding.cs
- CodeMethodReturnStatement.cs
- NativeMethods.cs
- GenericWebPart.cs
- DispatchWrapper.cs
- SubclassTypeValidatorAttribute.cs
- NullExtension.cs
- PassportIdentity.cs
- TextContainerHelper.cs
- TypeListConverter.cs
- CompoundFileDeflateTransform.cs
- BitmapEffectGroup.cs
- LogArchiveSnapshot.cs
- Int32AnimationBase.cs
- MediaTimeline.cs
- PropertyTabAttribute.cs
- Queue.cs
- DateBoldEvent.cs
- ColorEditor.cs
- UInt32Storage.cs
- ControlDesigner.cs
- SqlDataSourceStatusEventArgs.cs
- SqlDesignerDataSourceView.cs
- SafeEventHandle.cs
- SeparatorAutomationPeer.cs
- SessionPageStatePersister.cs
- DataColumn.cs
- ListBase.cs
- EventMap.cs
- RegexWriter.cs
- BuildProvider.cs
- StrokeCollectionDefaultValueFactory.cs
- HttpContextWrapper.cs
- DashStyle.cs
- XmlSchemas.cs
- XmlQualifiedNameTest.cs
- SqlMetaData.cs
- ListControl.cs
- PerformanceCounterPermissionAttribute.cs
- EngineSiteSapi.cs
- EntityDataSourceDesignerHelper.cs
- QuaternionIndependentAnimationStorage.cs
- RoutedUICommand.cs
- Deserializer.cs
- Calendar.cs
- VariableBinder.cs
- PageAdapter.cs
- FontFamily.cs
- cookiecollection.cs
- CompositeScriptReference.cs
- PtsContext.cs
- FastEncoder.cs
- RewritingPass.cs
- XmlSchemaSimpleType.cs
- SqlAliasesReferenced.cs
- XsdDateTime.cs
- StyleCollectionEditor.cs
- SqlMethods.cs
- AesCryptoServiceProvider.cs
- OSFeature.cs
- WebPartTransformerCollection.cs
- LayoutEditorPart.cs
- CompositeScriptReference.cs
- LockRecursionException.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ReadOnlyDictionary.cs
- SmiMetaData.cs
- VideoDrawing.cs
- CubicEase.cs
- RsaKeyIdentifierClause.cs
- X509ChainPolicy.cs
- DBConnectionString.cs
- HashCryptoHandle.cs
- MailDefinitionBodyFileNameEditor.cs
- DirectionalLight.cs
- ClientApiGenerator.cs
- InternalsVisibleToAttribute.cs
- UntypedNullExpression.cs
- CompositeDuplexBindingElement.cs
- SafeCloseHandleCritical.cs
- DataServiceExpressionVisitor.cs
- ServiceParser.cs