Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ExternalException.cs
- NamespaceQuery.cs
- Operator.cs
- FtpCachePolicyElement.cs
- DataGridViewRowsAddedEventArgs.cs
- Aggregates.cs
- ProgressPage.cs
- TagPrefixInfo.cs
- ResourceDisplayNameAttribute.cs
- TablePattern.cs
- CapabilitiesState.cs
- DBAsyncResult.cs
- XPathSingletonIterator.cs
- CultureTable.cs
- SafeArrayRankMismatchException.cs
- PromptStyle.cs
- Object.cs
- XmlHierarchicalEnumerable.cs
- WriterOutput.cs
- DbProviderConfigurationHandler.cs
- ToolStripDropDownClosingEventArgs.cs
- EastAsianLunisolarCalendar.cs
- Bits.cs
- DependentList.cs
- DataGridPagerStyle.cs
- X509ChainPolicy.cs
- StrongNameUtility.cs
- RelationshipEndMember.cs
- ClientProxyGenerator.cs
- AppDomainFactory.cs
- ComponentEditorPage.cs
- autovalidator.cs
- MaskedTextBoxTextEditor.cs
- RequiredFieldValidator.cs
- XmlObjectSerializerWriteContextComplex.cs
- AnimationTimeline.cs
- SQLInt16.cs
- RuleSettingsCollection.cs
- Pool.cs
- DataGridViewComboBoxCell.cs
- ConsoleCancelEventArgs.cs
- HTMLTagNameToTypeMapper.cs
- FloaterBaseParagraph.cs
- DataStorage.cs
- XmlToDatasetMap.cs
- ScriptingProfileServiceSection.cs
- IsolationInterop.cs
- SubclassTypeValidatorAttribute.cs
- HostProtectionException.cs
- ConnectionPointCookie.cs
- AuthenticatedStream.cs
- ComplexPropertyEntry.cs
- XmlSequenceWriter.cs
- TextEditorMouse.cs
- EdmComplexPropertyAttribute.cs
- PlainXmlWriter.cs
- OdbcCommandBuilder.cs
- Encoding.cs
- DynamicILGenerator.cs
- VariableValue.cs
- ExclusiveTcpTransportManager.cs
- FlowDocumentFormatter.cs
- complextypematerializer.cs
- BrowserInteropHelper.cs
- ApplyImportsAction.cs
- Registry.cs
- TextSpan.cs
- ListViewUpdatedEventArgs.cs
- GridViewPageEventArgs.cs
- SiteMapPath.cs
- DeclaredTypeValidator.cs
- RefreshPropertiesAttribute.cs
- HttpGetServerProtocol.cs
- PageCodeDomTreeGenerator.cs
- MissingMethodException.cs
- PreProcessor.cs
- ServiceErrorHandler.cs
- cookieexception.cs
- GenerateScriptTypeAttribute.cs
- FloaterBaseParaClient.cs
- X509Utils.cs
- ObjectDesignerDataSourceView.cs
- HtmlTitle.cs
- EntityViewGenerationConstants.cs
- _NTAuthentication.cs
- RectangleF.cs
- TraceEventCache.cs
- GridViewSelectEventArgs.cs
- VirtualDirectoryMappingCollection.cs
- InlineCollection.cs
- SystemColors.cs
- DataPagerCommandEventArgs.cs
- BindingsCollection.cs
- BaseParser.cs
- BehaviorDragDropEventArgs.cs
- AxisAngleRotation3D.cs
- PriorityChain.cs
- MessageSmuggler.cs
- PreProcessInputEventArgs.cs
- MetadataItemCollectionFactory.cs