Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Framework / MS / Internal / PtsHost / UnmanagedHandle.cs / 1 / 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 : grzegorz - 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; } } ////// 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. //---------------------------------------------------------------------------- // // 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 : grzegorz - 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; } } ////// 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
- MediaCommands.cs
- ArgIterator.cs
- DesignerAdapterUtil.cs
- ProfileInfo.cs
- SubstitutionResponseElement.cs
- ValidatingReaderNodeData.cs
- DecoratedNameAttribute.cs
- ZipPackagePart.cs
- ActivityInstanceMap.cs
- OleTxTransaction.cs
- SqlInternalConnectionTds.cs
- SectionXmlInfo.cs
- SrgsGrammarCompiler.cs
- Clipboard.cs
- _Events.cs
- RemotingConfigParser.cs
- StaticExtension.cs
- PointAnimationUsingKeyFrames.cs
- AccessDataSourceDesigner.cs
- RoleServiceManager.cs
- StaticSiteMapProvider.cs
- ProxyWebPartManager.cs
- ZoomingMessageFilter.cs
- DesignColumn.cs
- DataColumn.cs
- SecurityUtils.cs
- PartialList.cs
- XmlQueryRuntime.cs
- MinimizableAttributeTypeConverter.cs
- NodeFunctions.cs
- Fonts.cs
- MonitoringDescriptionAttribute.cs
- EntityDataSourceContextDisposingEventArgs.cs
- Error.cs
- GridViewCellAutomationPeer.cs
- PointLight.cs
- TraceLevelStore.cs
- TreeViewHitTestInfo.cs
- ListBoxAutomationPeer.cs
- IncrementalCompileAnalyzer.cs
- Transform3DGroup.cs
- FileSystemInfo.cs
- SHA512Managed.cs
- PreviewKeyDownEventArgs.cs
- GlyphElement.cs
- ControlPaint.cs
- DataTemplate.cs
- DayRenderEvent.cs
- Vector3DAnimation.cs
- DataBinder.cs
- TimelineGroup.cs
- LinqDataSourceView.cs
- GiveFeedbackEvent.cs
- SimpleFieldTemplateUserControl.cs
- Range.cs
- WsatProxy.cs
- SiteMapDataSourceView.cs
- ObjectComplexPropertyMapping.cs
- ImageDrawing.cs
- Paragraph.cs
- _ConnectStream.cs
- UpdateTracker.cs
- CqlParser.cs
- ToolStripStatusLabel.cs
- Rectangle.cs
- EntityDataSourceColumn.cs
- GridViewRowCollection.cs
- DependencyPropertyKey.cs
- OwnerDrawPropertyBag.cs
- SqlTriggerContext.cs
- BindingMemberInfo.cs
- ListSortDescriptionCollection.cs
- AuthenticationConfig.cs
- IndexExpression.cs
- CommentEmitter.cs
- Formatter.cs
- InternalPermissions.cs
- JoinCqlBlock.cs
- XmlSchemas.cs
- QueryCreatedEventArgs.cs
- Mappings.cs
- ListViewInsertedEventArgs.cs
- Rotation3D.cs
- RecognitionEventArgs.cs
- SchemaObjectWriter.cs
- ScrollableControlDesigner.cs
- OletxResourceManager.cs
- AuthenticationException.cs
- XamlPointCollectionSerializer.cs
- Exceptions.cs
- GradientBrush.cs
- MetaTableHelper.cs
- WinInet.cs
- ProfilePropertySettingsCollection.cs
- TableDetailsCollection.cs
- ExpandoClass.cs
- SafeArrayTypeMismatchException.cs
- CreatingCookieEventArgs.cs
- DesignerDataSchemaClass.cs
- SaveFileDialog.cs