Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ResolveMatchesMessage11.cs
- QilLiteral.cs
- PointLightBase.cs
- DefaultMemberAttribute.cs
- DataGridViewButtonColumn.cs
- RawKeyboardInputReport.cs
- SplashScreenNativeMethods.cs
- ToolStripSettings.cs
- Visual3D.cs
- FilterableAttribute.cs
- GridSplitter.cs
- TransformPattern.cs
- Point.cs
- XmlUtf8RawTextWriter.cs
- GcHandle.cs
- CacheHelper.cs
- SqlDataSourceQuery.cs
- DocumentGridPage.cs
- PerfCounterSection.cs
- OutputCacheProfile.cs
- NavigationHelper.cs
- ToolBarDesigner.cs
- _AuthenticationState.cs
- SerialReceived.cs
- ReadOnlyHierarchicalDataSourceView.cs
- PropertyEntry.cs
- EventBuilder.cs
- WinEventWrap.cs
- HierarchicalDataBoundControl.cs
- DataObject.cs
- ModifierKeysConverter.cs
- ScaleTransform3D.cs
- BitmapFrame.cs
- ListDictionaryInternal.cs
- Delay.cs
- templategroup.cs
- DBConnection.cs
- ReadOnlyDataSource.cs
- TemplateControlParser.cs
- MasterPage.cs
- Header.cs
- LocationReferenceEnvironment.cs
- WMIInterop.cs
- StateMachineDesignerPaint.cs
- DataRowExtensions.cs
- FormClosedEvent.cs
- ItemType.cs
- _CommandStream.cs
- nulltextcontainer.cs
- CustomError.cs
- PriorityBindingExpression.cs
- PerspectiveCamera.cs
- BindingExpression.cs
- WarningException.cs
- XMLDiffLoader.cs
- UnsafeNativeMethods.cs
- ContainerUtilities.cs
- SmtpNtlmAuthenticationModule.cs
- SecurityResources.cs
- AppDomainAttributes.cs
- EastAsianLunisolarCalendar.cs
- _FtpControlStream.cs
- InvokeHandlers.cs
- _NetRes.cs
- HtmlToClrEventProxy.cs
- CanonicalXml.cs
- CommonDialog.cs
- EventLogPermissionHolder.cs
- DataTableClearEvent.cs
- FormViewPagerRow.cs
- Span.cs
- DependencyPropertyKey.cs
- SerializationFieldInfo.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- SelectedDatesCollection.cs
- AutomationPattern.cs
- Authorization.cs
- RequestNavigateEventArgs.cs
- ConsumerConnectionPoint.cs
- NativeRecognizer.cs
- _WebProxyDataBuilder.cs
- ScalarConstant.cs
- DocumentGridPage.cs
- COM2Enum.cs
- Context.cs
- WmlCalendarAdapter.cs
- DesignerObjectListAdapter.cs
- PeerEndPoint.cs
- XmlQualifiedNameTest.cs
- Stack.cs
- AuthenticationService.cs
- KeyTimeConverter.cs
- TemplateBindingExtensionConverter.cs
- SQlBooleanStorage.cs
- TableLayoutPanelCellPosition.cs
- MutableAssemblyCacheEntry.cs
- Wildcard.cs
- DataBoundControlAdapter.cs
- PerformanceCounterPermissionEntry.cs
- UdpReplyToBehavior.cs