Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / PtsHost / UnmanagedHandle.cs / 1305600 / UnmanagedHandle.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: UnmanagedHandle.cs // // Description: Definition for Unmanaged Handle. Provides identity (handle), // which can be used in unmanaged world. // // History: // 05/02/2003 : [....] - moving from Avalon branch. // //--------------------------------------------------------------------------- using System; namespace MS.Internal.PtsHost { ////// Provides identity (handle), which can be used in unmanaged world. /// If object is passed into unmanaged world, and there is a need to identify /// that object later on, its class should inherit from UnmanagedHandle. /// internal class UnmanagedHandle : IDisposable { ////// Constructor. Used when object derives from UnmanagedHandle. /// /// /// PTS context /// protected UnmanagedHandle(PtsContext ptsContext) { _ptsContext = ptsContext; _handle = ptsContext.CreateHandle(this); } ////// Dispose the object and release handle. /// public virtual void Dispose() { try { _ptsContext.ReleaseHandle(_handle); } finally { _handle = IntPtr.Zero; } GC.SuppressFinalize(this); } ////// Handle of an object. /// internal IntPtr Handle { get { return _handle; } } private IntPtr _handle; ////// PtsContext that is the owner of the handle. /// It is required to store it here for Dispose. When Dispose is called /// it is not always possible to get instance of PtsContext that /// has been used to create this handle. /// internal PtsContext PtsContext { get { return _ptsContext; } } private readonly PtsContext _ptsContext; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ClientType.cs
- FrameDimension.cs
- EntityDataSourceContainerNameItem.cs
- NativeMethods.cs
- AnimationClockResource.cs
- SortKey.cs
- RequiredArgumentAttribute.cs
- Figure.cs
- SqlMultiplexer.cs
- WsatStrings.cs
- Cursor.cs
- CollectionViewProxy.cs
- CompositeCollection.cs
- SAPICategories.cs
- AsmxEndpointPickerExtension.cs
- FileLogRecord.cs
- CultureTableRecord.cs
- ContractType.cs
- SafeFileHandle.cs
- SqlPersonalizationProvider.cs
- ObjectKeyFrameCollection.cs
- AdRotator.cs
- StoreAnnotationsMap.cs
- TraceHandler.cs
- WebPartConnection.cs
- DataGridViewImageCell.cs
- BaseDataListPage.cs
- Canonicalizers.cs
- ProfileSettingsCollection.cs
- CryptoStream.cs
- LogicalExpr.cs
- DoubleAnimationUsingKeyFrames.cs
- SimpleTypeResolver.cs
- LicenseManager.cs
- OneOfScalarConst.cs
- FontUnitConverter.cs
- StylusButtonEventArgs.cs
- ConfigXmlSignificantWhitespace.cs
- counter.cs
- InfocardExtendedInformationEntry.cs
- XPathNodeList.cs
- HttpProfileGroupBase.cs
- IgnoreFileBuildProvider.cs
- RegexTree.cs
- SystemIPInterfaceProperties.cs
- WorkflowInstance.cs
- CodeVariableReferenceExpression.cs
- DiscriminatorMap.cs
- ReceiveSecurityHeaderElementManager.cs
- QilCloneVisitor.cs
- IChannel.cs
- HtmlShim.cs
- SafeNativeMethodsOther.cs
- Repeater.cs
- TraceHandlerErrorFormatter.cs
- RunClient.cs
- FreezableCollection.cs
- MarkerProperties.cs
- PathTooLongException.cs
- HelpInfo.cs
- OpacityConverter.cs
- CompositeClientFormatter.cs
- RuntimeConfig.cs
- MonitoringDescriptionAttribute.cs
- hebrewshape.cs
- SQLInt32Storage.cs
- MultipartContentParser.cs
- DesignBindingPicker.cs
- ImageMapEventArgs.cs
- XsdBuildProvider.cs
- SapiGrammar.cs
- SecurityUtils.cs
- BufferedWebEventProvider.cs
- CorrelationTokenInvalidatedHandler.cs
- HasCopySemanticsAttribute.cs
- SocketException.cs
- _SslState.cs
- _Win32.cs
- IDQuery.cs
- XmlNullResolver.cs
- Rotation3DKeyFrameCollection.cs
- ScriptResourceInfo.cs
- SchemaNames.cs
- TextTreeExtractElementUndoUnit.cs
- OuterGlowBitmapEffect.cs
- ViewStateException.cs
- StatusStrip.cs
- DBCSCodePageEncoding.cs
- MsmqActivation.cs
- AsymmetricSignatureFormatter.cs
- XmlAnyElementAttribute.cs
- XamlBrushSerializer.cs
- RadioButtonBaseAdapter.cs
- DataSourceHelper.cs
- GlobalAclOperationRequirement.cs
- SQLBytesStorage.cs
- UriTemplateVariablePathSegment.cs
- dataSvcMapFileLoader.cs
- PropertyContainer.cs
- WebDisplayNameAttribute.cs