Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / System.Runtime.DurableInstancing / System / Runtime / CompletedAsyncResult.cs / 1305376 / CompletedAsyncResult.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Runtime { using System; using System.Threading; //An AsyncResult that completes as soon as it is instantiated. class CompletedAsyncResult : AsyncResult { public CompletedAsyncResult(AsyncCallback callback, object state) : base(callback, state) { Complete(true); } [Fx.Tag.GuaranteeNonBlocking] public static void End(IAsyncResult result) { Fx.AssertAndThrowFatal(result.IsCompleted, "CompletedAsyncResult was not completed!"); AsyncResult.End(result); } } class CompletedAsyncResult : AsyncResult { T data; public CompletedAsyncResult(T data, AsyncCallback callback, object state) : base(callback, state) { this.data = data; Complete(true); } [Fx.Tag.GuaranteeNonBlocking] public static T End(IAsyncResult result) { Fx.AssertAndThrowFatal(result.IsCompleted, "CompletedAsyncResult was not completed!"); CompletedAsyncResult completedResult = AsyncResult.End >(result); return completedResult.data; } } class CompletedAsyncResult : AsyncResult { TResult resultData; TParameter parameter; public CompletedAsyncResult(TResult resultData, TParameter parameter, AsyncCallback callback, object state) : base(callback, state) { this.resultData = resultData; this.parameter = parameter; Complete(true); } [Fx.Tag.GuaranteeNonBlocking] public static TResult End(IAsyncResult result, out TParameter parameter) { Fx.AssertAndThrowFatal(result.IsCompleted, "CompletedAsyncResult was not completed!"); CompletedAsyncResult completedResult = AsyncResult.End >(result); parameter = completedResult.parameter; return completedResult.resultData; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Runtime { using System; using System.Threading; //An AsyncResult that completes as soon as it is instantiated. class CompletedAsyncResult : AsyncResult { public CompletedAsyncResult(AsyncCallback callback, object state) : base(callback, state) { Complete(true); } [Fx.Tag.GuaranteeNonBlocking] public static void End(IAsyncResult result) { Fx.AssertAndThrowFatal(result.IsCompleted, "CompletedAsyncResult was not completed!"); AsyncResult.End (result); } } class CompletedAsyncResult : AsyncResult { T data; public CompletedAsyncResult(T data, AsyncCallback callback, object state) : base(callback, state) { this.data = data; Complete(true); } [Fx.Tag.GuaranteeNonBlocking] public static T End(IAsyncResult result) { Fx.AssertAndThrowFatal(result.IsCompleted, "CompletedAsyncResult was not completed!"); CompletedAsyncResult completedResult = AsyncResult.End >(result); return completedResult.data; } } class CompletedAsyncResult : AsyncResult { TResult resultData; TParameter parameter; public CompletedAsyncResult(TResult resultData, TParameter parameter, AsyncCallback callback, object state) : base(callback, state) { this.resultData = resultData; this.parameter = parameter; Complete(true); } [Fx.Tag.GuaranteeNonBlocking] public static TResult End(IAsyncResult result, out TParameter parameter) { Fx.AssertAndThrowFatal(result.IsCompleted, "CompletedAsyncResult was not completed!"); CompletedAsyncResult completedResult = AsyncResult.End >(result); parameter = completedResult.parameter; return completedResult.resultData; } } } // 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
- UnknownWrapper.cs
- ImageAnimator.cs
- ProxyFragment.cs
- OptionUsage.cs
- ResXResourceReader.cs
- ObjectStateManagerMetadata.cs
- SystemWebCachingSectionGroup.cs
- SerializationFieldInfo.cs
- StatusBarAutomationPeer.cs
- RowCache.cs
- ValueConversionAttribute.cs
- QuaternionAnimationBase.cs
- MultiPageTextView.cs
- LicenseProviderAttribute.cs
- _OverlappedAsyncResult.cs
- WebPartZone.cs
- OleDbFactory.cs
- XmlComplianceUtil.cs
- HttpResponseInternalWrapper.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- WithParamAction.cs
- namescope.cs
- securitycriticaldata.cs
- clipboard.cs
- SystemUnicastIPAddressInformation.cs
- DataGridState.cs
- AutomationElementCollection.cs
- StackBuilderSink.cs
- ImageMap.cs
- LambdaCompiler.Unary.cs
- DropSourceBehavior.cs
- ParsedAttributeCollection.cs
- SqlCacheDependencyDatabaseCollection.cs
- ScheduleChanges.cs
- SubqueryRules.cs
- FileChangesMonitor.cs
- LinearGradientBrush.cs
- PropertySourceInfo.cs
- X509CertificateChain.cs
- ConfigDefinitionUpdates.cs
- MonikerBuilder.cs
- JpegBitmapEncoder.cs
- SQLInt16Storage.cs
- AssemblyName.cs
- TableRow.cs
- HtmlInputText.cs
- IgnoreFileBuildProvider.cs
- TabItemWrapperAutomationPeer.cs
- ComponentEditorForm.cs
- ThemeableAttribute.cs
- Expander.cs
- CacheEntry.cs
- RenderTargetBitmap.cs
- DivideByZeroException.cs
- ColorAnimation.cs
- AddressHeaderCollection.cs
- DateTimeOffset.cs
- Preprocessor.cs
- Frame.cs
- XamlToRtfParser.cs
- TypeUtils.cs
- CompareValidator.cs
- XmlDocumentType.cs
- DesignerActionUIStateChangeEventArgs.cs
- Encoder.cs
- XsdBuilder.cs
- SendMessageChannelCache.cs
- SpellerInterop.cs
- SingleConverter.cs
- EpmTargetTree.cs
- QueryContinueDragEventArgs.cs
- FormsAuthenticationConfiguration.cs
- EntitySetBaseCollection.cs
- TimeZoneInfo.cs
- ConfigurationSectionHelper.cs
- FormViewActionList.cs
- ImageListStreamer.cs
- TemplateControlParser.cs
- wgx_commands.cs
- DesignerActionMethodItem.cs
- ProcessHostMapPath.cs
- ResourceType.cs
- ParenExpr.cs
- WorkflowViewStateService.cs
- WinInetCache.cs
- DropDownButton.cs
- ProcessInfo.cs
- Base64Encoder.cs
- VersionValidator.cs
- EntityDataReader.cs
- OutputCacheProfileCollection.cs
- Base64Encoder.cs
- XmlHierarchicalEnumerable.cs
- ScrollContentPresenter.cs
- NumberSubstitution.cs
- CaseExpr.cs
- BaseProcessor.cs
- MessageQueueCriteria.cs
- DataGridRow.cs
- RightsManagementPermission.cs